1 // Copyright 2017 The Bazel Authors. All rights reserved. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 package com.google.devtools.build.android.desugar; 15 16 import java.io.Closeable; 17 import java.io.IOException; 18 import java.io.InputStream; 19 import java.util.zip.ZipEntry; 20 21 /** Input file provider allows to iterate on relative path filename of a directory or a jar file. */ 22 interface InputFileProvider extends Closeable, Iterable<String> { 23 24 /** 25 * Return a ZipEntry for {@code filename}. If the provider is a {@link ZipInputFileProvider}, the 26 * method returns the existing ZipEntry in order to keep its metadata, otherwise a new one is 27 * created. 28 */ 29 ZipEntry getZipEntry(String filename); 30 31 /** 32 * This method returns an input stream allowing to read the file {@code filename}, it is the 33 * responsibility of the caller to close this stream. 34 */ 35 InputStream getInputStream(String filename) throws IOException; 36 } 37