Package org.zeroturnaround.zip
Class FileSource
- java.lang.Object
-
- org.zeroturnaround.zip.FileSource
-
- All Implemented Interfaces:
ZipEntrySource
public class FileSource extends java.lang.Object implements ZipEntrySource
-
-
Constructor Summary
Constructors Constructor Description FileSource(java.lang.String path, java.io.File file)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.zip.ZipEntrygetEntry()java.io.InputStreamgetInputStream()java.lang.StringgetPath()static FileSource[]pair(java.io.File[] files, java.lang.String[] names)Creates a sequence of FileSource objects via mapping a sequence of files to the sequence of corresponding names for the entriesjava.lang.StringtoString()
-
-
-
Method Detail
-
getPath
public java.lang.String getPath()
- Specified by:
getPathin interfaceZipEntrySource- Returns:
- path of the given entry (not
null).
-
getEntry
public java.util.zip.ZipEntry getEntry()
- Specified by:
getEntryin interfaceZipEntrySource- Returns:
- meta-data of the given entry (not
null).
-
getInputStream
public java.io.InputStream getInputStream() throws java.io.IOException- Specified by:
getInputStreamin interfaceZipEntrySource- Returns:
- an input stream of the given entry
or
nullif this entry is a directory. - Throws:
java.io.IOException- can throw getting the InputStream
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
pair
public static FileSource[] pair(java.io.File[] files, java.lang.String[] names)
Creates a sequence of FileSource objects via mapping a sequence of files to the sequence of corresponding names for the entries- Parameters:
files- file array to form the data of the objects in the resulting arraynames- file array to form the names of the objects in the resulting array- Returns:
- array of FileSource objects created by mapping given files array to the given names array one by one
- Throws:
java.lang.IllegalArgumentException- if the names array contains less items than the files array
-
-