Class ZipInputStream
java.lang.Object
java.io.InputStream
net.lingala.zip4j.io.inputstream.ZipInputStream
- All Implemented Interfaces:
Closeable, AutoCloseable
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate CRC32private DecompressedInputStreamprivate byte[]private booleanprivate HeaderReaderprivate PushbackInputStreamprivate LocalFileHeaderprivate char[]private PasswordCallbackprivate booleanprivate Zip4jConfig -
Constructor Summary
ConstructorsModifierConstructorDescriptionZipInputStream(InputStream inputStream) ZipInputStream(InputStream inputStream, char[] password) ZipInputStream(InputStream inputStream, char[] password, Charset charset) ZipInputStream(InputStream inputStream, char[] password, Zip4jConfig zip4jConfig) privateZipInputStream(InputStream inputStream, char[] password, PasswordCallback passwordCallback, Zip4jConfig zip4jConfig) ZipInputStream(InputStream inputStream, Charset charset) ZipInputStream(InputStream inputStream, PasswordCallback passwordCallback) ZipInputStream(InputStream inputStream, PasswordCallback passwordCallback, Charset charset) ZipInputStream(InputStream inputStream, PasswordCallback passwordCallback, Zip4jConfig zip4jConfig) -
Method Summary
Modifier and TypeMethodDescriptionprivate voidintprivate booleancheckIfZip64ExtraDataRecordPresentInLFH(List<ExtraDataRecord> extraDataRecords) voidclose()private voidprivate intgetAesEncryptionHeaderSize(AESExtraDataRecord aesExtraDataRecord) private longgetCompressedSize(LocalFileHeader localFileHeader) private intgetEncryptionHeaderSize(LocalFileHeader localFileHeader) getNextEntry(FileHeader fileHeader, boolean readUntilEndOfCurrentEntryIfOpen) private CipherInputStream<?> initializeCipherInputStream(ZipEntryInputStream zipEntryInputStream, LocalFileHeader localFileHeader) private DecompressedInputStreaminitializeDecompressorForThisEntry(CipherInputStream<?> cipherInputStream, LocalFileHeader localFileHeader) private DecompressedInputStreaminitializeEntryInputStream(LocalFileHeader localFileHeader) private booleanisEncryptionMethodZipStandard(LocalFileHeader localFileHeader) private booleanisEntryDirectory(String entryName) intread()intread(byte[] b) intread(byte[] b, int off, int len) private voidprivate voidprivate voidvoidsetPassword(char[] password) Sets the password for the inputstream.private voidprivate voidverifyLocalFileHeader(LocalFileHeader localFileHeader) Methods inherited from class InputStream
mark, markSupported, reset, skip
-
Field Details
-
inputStream
-
decompressedInputStream
-
headerReader
-
password
private char[] password -
passwordCallback
-
localFileHeader
-
crc32
-
endOfEntryBuffer
private byte[] endOfEntryBuffer -
canSkipExtendedLocalFileHeader
private boolean canSkipExtendedLocalFileHeader -
zip4jConfig
-
streamClosed
private boolean streamClosed -
entryEOFReached
private boolean entryEOFReached
-
-
Constructor Details
-
ZipInputStream
-
ZipInputStream
-
ZipInputStream
-
ZipInputStream
-
ZipInputStream
-
ZipInputStream
-
ZipInputStream
-
ZipInputStream
public ZipInputStream(InputStream inputStream, PasswordCallback passwordCallback, Zip4jConfig zip4jConfig) -
ZipInputStream
private ZipInputStream(InputStream inputStream, char[] password, PasswordCallback passwordCallback, Zip4jConfig zip4jConfig)
-
-
Method Details
-
getNextEntry
- Throws:
IOException
-
getNextEntry
public LocalFileHeader getNextEntry(FileHeader fileHeader, boolean readUntilEndOfCurrentEntryIfOpen) throws IOException - Throws:
IOException
-
read
- Specified by:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
available
- Overrides:
availablein classInputStream- Throws:
IOException
-
setPassword
public void setPassword(char[] password) Sets the password for the inputstream. This password will be used for any subsequent encrypted entries that will be read from this stream. If this method is called when an entry is being read, it has no effect on the read action of the current entry, and the password will take effect from any subsequent entry reads.- Parameters:
password- Password to be used for reading of entries from the zip input stream
-
endOfCompressedDataReached
- Throws:
IOException
-
initializeEntryInputStream
private DecompressedInputStream initializeEntryInputStream(LocalFileHeader localFileHeader) throws IOException - Throws:
IOException
-
initializeCipherInputStream
private CipherInputStream<?> initializeCipherInputStream(ZipEntryInputStream zipEntryInputStream, LocalFileHeader localFileHeader) throws IOException - Throws:
IOException
-
initializeDecompressorForThisEntry
private DecompressedInputStream initializeDecompressorForThisEntry(CipherInputStream<?> cipherInputStream, LocalFileHeader localFileHeader) throws ZipException - Throws:
ZipException
-
readExtendedLocalFileHeaderIfPresent
- Throws:
IOException
-
verifyLocalFileHeader
- Throws:
IOException
-
checkIfZip64ExtraDataRecordPresentInLFH
-
verifyCrc
- Throws:
IOException
-
resetFields
private void resetFields() -
isEntryDirectory
-
getCompressedSize
- Throws:
ZipException
-
getEncryptionHeaderSize
- Throws:
ZipException
-
readUntilEndOfEntry
- Throws:
IOException
-
getAesEncryptionHeaderSize
- Throws:
ZipException
-
isEncryptionMethodZipStandard
-
assertStreamOpen
- Throws:
IOException
-