org.apache.commons.compress.archivers.zip
Class ZipArchiveInputStream
java.lang.Object
java.io.InputStream
org.apache.commons.compress.archivers.ArchiveInputStream
org.apache.commons.compress.archivers.zip.ZipArchiveInputStream
- All Implemented Interfaces:
- java.io.Closeable
- Direct Known Subclasses:
- JarArchiveInputStream
public class ZipArchiveInputStream
- extends ArchiveInputStream
Implements an input stream that can read Zip archives.
Note that ZipEntry.getSize() may return -1 if the DEFLATE algorithm is used, as the size information
is not available from the header.
The ZipFile class is preferred when reading from files.
- See Also:
ZipFile
| Methods inherited from class java.io.InputStream |
available, mark, markSupported, read, reset |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ZipArchiveInputStream
public ZipArchiveInputStream(java.io.InputStream inputStream)
ZipArchiveInputStream
public ZipArchiveInputStream(java.io.InputStream inputStream,
java.lang.String encoding,
boolean useUnicodeExtraFields)
- Parameters:
encoding - the encoding to use for file names, use null
for the platform's default encodinguseUnicodeExtraFields - whether to use InfoZIP Unicode
Extra Fields (if present) to set the file names.
getNextZipEntry
public ZipArchiveEntry getNextZipEntry()
throws java.io.IOException
- Throws:
java.io.IOException
getNextEntry
public ArchiveEntry getNextEntry()
throws java.io.IOException
- Description copied from class:
ArchiveInputStream
- Returns the next Archive Entry in this Stream.
- Specified by:
getNextEntry in class ArchiveInputStream
- Returns:
- the next entry,
or
null if there are no more entries
- Throws:
java.io.IOException - if the next entry could not be read
read
public int read(byte[] buffer,
int start,
int length)
throws java.io.IOException
- Overrides:
read in class java.io.InputStream
- Throws:
java.io.IOException
close
public void close()
throws java.io.IOException
- Specified by:
close in interface java.io.Closeable- Overrides:
close in class java.io.InputStream
- Throws:
java.io.IOException
skip
public long skip(long value)
throws java.io.IOException
- Overrides:
skip in class java.io.InputStream
- Throws:
java.io.IOException
matches
public static boolean matches(byte[] signature,
int length)