Package net.lingala.zip4j.io.inputstream
Class CipherInputStream<T extends Decrypter>
- java.lang.Object
-
- java.io.InputStream
-
- net.lingala.zip4j.io.inputstream.CipherInputStream<T>
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
- Direct Known Subclasses:
AesCipherInputStream
,NoCipherInputStream
,ZipStandardCipherInputStream
abstract class CipherInputStream<T extends Decrypter> extends java.io.InputStream
-
-
Field Summary
Fields Modifier and Type Field Description private T
decrypter
private byte[]
lastReadRawDataCache
private LocalFileHeader
localFileHeader
private byte[]
singleByteBuffer
private ZipEntryInputStream
zipEntryInputStream
-
Constructor Summary
Constructors Constructor Description CipherInputStream(ZipEntryInputStream zipEntryInputStream, LocalFileHeader localFileHeader, char[] password, int bufferSize, boolean useUtf8ForPassword)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description private void
cacheRawData(byte[] b, int len)
void
close()
protected void
endOfEntryReached(java.io.InputStream inputStream, int numberOfBytesPushedBack)
T
getDecrypter()
byte[]
getLastReadRawDataCache()
LocalFileHeader
getLocalFileHeader()
protected long
getNumberOfBytesReadForThisEntry()
protected abstract T
initializeDecrypter(LocalFileHeader localFileHeader, char[] password, boolean useUtf8ForPassword)
int
read()
int
read(byte[] b)
int
read(byte[] b, int off, int len)
protected int
readRaw(byte[] b)
-
-
-
Field Detail
-
zipEntryInputStream
private ZipEntryInputStream zipEntryInputStream
-
lastReadRawDataCache
private byte[] lastReadRawDataCache
-
singleByteBuffer
private byte[] singleByteBuffer
-
localFileHeader
private LocalFileHeader localFileHeader
-
-
Constructor Detail
-
CipherInputStream
public CipherInputStream(ZipEntryInputStream zipEntryInputStream, LocalFileHeader localFileHeader, char[] password, int bufferSize, boolean useUtf8ForPassword) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
read
public int read() throws java.io.IOException
- Specified by:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
read
public int read(byte[] b) throws java.io.IOException
- Overrides:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
read
public int read(byte[] b, int off, int len) throws java.io.IOException
- Overrides:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.InputStream
- Throws:
java.io.IOException
-
getLastReadRawDataCache
public byte[] getLastReadRawDataCache()
-
readRaw
protected int readRaw(byte[] b) throws java.io.IOException
- Throws:
java.io.IOException
-
cacheRawData
private void cacheRawData(byte[] b, int len)
-
getDecrypter
public T getDecrypter()
-
endOfEntryReached
protected void endOfEntryReached(java.io.InputStream inputStream, int numberOfBytesPushedBack) throws java.io.IOException
- Throws:
java.io.IOException
-
getNumberOfBytesReadForThisEntry
protected long getNumberOfBytesReadForThisEntry()
-
getLocalFileHeader
public LocalFileHeader getLocalFileHeader()
-
initializeDecrypter
protected abstract T initializeDecrypter(LocalFileHeader localFileHeader, char[] password, boolean useUtf8ForPassword) throws java.io.IOException
- Throws:
java.io.IOException
-
-