Package net.lingala.zip4j.io.inputstream
Class ZipInputStream
java.lang.Object
java.io.InputStream
net.lingala.zip4j.io.inputstream.ZipInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
private CRC32
private DecompressedInputStream
private byte[]
private boolean
private HeaderReader
private PushbackInputStream
private LocalFileHeader
private char[]
private PasswordCallback
private boolean
private 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) private
ZipInputStream
(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 void
int
private boolean
checkIfZip64ExtraDataRecordPresentInLFH
(List<ExtraDataRecord> extraDataRecords) void
close()
private void
private int
getAesEncryptionHeaderSize
(AESExtraDataRecord aesExtraDataRecord) private long
getCompressedSize
(LocalFileHeader localFileHeader) private int
getEncryptionHeaderSize
(LocalFileHeader localFileHeader) getNextEntry
(FileHeader fileHeader, boolean readUntilEndOfCurrentEntryIfOpen) private CipherInputStream
<?> initializeCipherInputStream
(ZipEntryInputStream zipEntryInputStream, LocalFileHeader localFileHeader) private DecompressedInputStream
initializeDecompressorForThisEntry
(CipherInputStream<?> cipherInputStream, LocalFileHeader localFileHeader) private DecompressedInputStream
initializeEntryInputStream
(LocalFileHeader localFileHeader) private boolean
isEncryptionMethodZipStandard
(LocalFileHeader localFileHeader) private boolean
isEntryDirectory
(String entryName) int
read()
int
read
(byte[] b) int
read
(byte[] b, int off, int len) private void
private void
private void
void
setPassword
(char[] password) Sets the password for the inputstream.private void
private void
verifyLocalFileHeader
(LocalFileHeader localFileHeader) Methods inherited from class java.io.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:
read
in classInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classInputStream
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
-
available
- Overrides:
available
in 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
-