2 * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.yangtools.yang2sources.plugin;
10 import com.google.common.base.Preconditions;
11 import java.io.IOException;
12 import java.io.InputStream;
13 import java.util.zip.ZipEntry;
14 import java.util.zip.ZipFile;
16 class YangSourceInZipFile extends YangSourceFromDependency {
18 private final ZipFile file;
19 private final ZipEntry entry;
21 YangSourceInZipFile(ZipFile file, ZipEntry entry) {
22 this.file = Preconditions.checkNotNull(file);
23 this.entry = Preconditions.checkNotNull(entry);
28 return entry.getSize();
32 public InputStream openStream() throws IOException {
33 return file.getInputStream(entry);
37 String getDescription() {
38 return file.getName() + "::" + entry.getName();