|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.InputStream
org.apache.commons.compress.archivers.ArchiveInputStream
org.apache.commons.compress.archivers.zip.ZipArchiveInputStream
public class ZipArchiveInputStream
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.
ZipFile
Constructor Summary | |
---|---|
ZipArchiveInputStream(java.io.InputStream inputStream)
|
|
ZipArchiveInputStream(java.io.InputStream inputStream,
java.lang.String encoding,
boolean useUnicodeExtraFields)
|
|
ZipArchiveInputStream(java.io.InputStream inputStream,
java.lang.String encoding,
boolean useUnicodeExtraFields,
boolean allowStoredEntriesWithDataDescriptor)
|
Method Summary | |
---|---|
boolean |
canReadEntryData(ArchiveEntry ae)
Whether this class is able to read the given entry. |
void |
close()
|
ArchiveEntry |
getNextEntry()
Returns the next Archive Entry in this Stream. |
ZipArchiveEntry |
getNextZipEntry()
|
static boolean |
matches(byte[] signature,
int length)
Checks if the signature matches what is expected for a zip file. |
int |
read(byte[] buffer,
int start,
int length)
|
long |
skip(long value)
|
Methods inherited from class org.apache.commons.compress.archivers.ArchiveInputStream |
---|
count, count, getBytesRead, getCount, pushedBackBytes, read |
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 |
Constructor Detail |
---|
public ZipArchiveInputStream(java.io.InputStream inputStream)
public ZipArchiveInputStream(java.io.InputStream inputStream, java.lang.String encoding, boolean useUnicodeExtraFields)
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.public ZipArchiveInputStream(java.io.InputStream inputStream, java.lang.String encoding, boolean useUnicodeExtraFields, boolean allowStoredEntriesWithDataDescriptor)
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.allowStoredEntriesWithDataDescriptor
- whether the stream
will try to read STORED entries that use a data descriptorMethod Detail |
---|
public ZipArchiveEntry getNextZipEntry() throws java.io.IOException
java.io.IOException
public ArchiveEntry getNextEntry() throws java.io.IOException
getNextEntry
in class ArchiveInputStream
null
if there are no more entries
java.io.IOException
- if the next entry could not be readpublic boolean canReadEntryData(ArchiveEntry ae)
May return false if it is set up to use encryption or a compression method that hasn't been implemented yet.
canReadEntryData
in class ArchiveInputStream
public int read(byte[] buffer, int start, int length) throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in class java.io.InputStream
java.io.IOException
public long skip(long value) throws java.io.IOException
skip
in class java.io.InputStream
java.io.IOException
public static boolean matches(byte[] signature, int length)
signature
- the bytes to checklength
- the number of bytes to check
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |