Package org.apache.poi.poifs.crypt
Class ChunkedCipherInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
org.apache.poi.util.LittleEndianInputStream
org.apache.poi.poifs.crypt.ChunkedCipherInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable,LittleEndianInput
-
Constructor Summary
ConstructorsConstructorDescriptionChunkedCipherInputStream(InputStream stream, long size, int chunkSize) ChunkedCipherInputStream(InputStream stream, long size, int chunkSize, int initialPos) -
Method Summary
Modifier and TypeMethodDescriptionintlonggetPos()final CipherinitCipherForBlock(int block) voidmark(int readlimit) booleanintread()intread(byte[] b, int off, int len) voidreadPlain(byte[] b, int off, int len) Used when BIFF header fields (sid, size) are being read.voidreset()voidsetNextRecordSize(int recordSize) Some ciphers (actually just XOR) are based on the record size, which needs to be set before decryptionlongskip(long n) Methods inherited from class org.apache.poi.util.LittleEndianInputStream
getReadIndex, readByte, readDouble, readFloat, readFully, readFully, readInt, readLong, readShort, readUByte, readUInt, readUShort, skipFullyMethods inherited from class java.io.FilterInputStream
close, readMethods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Constructor Details
-
ChunkedCipherInputStream
public ChunkedCipherInputStream(InputStream stream, long size, int chunkSize) throws GeneralSecurityException - Throws:
GeneralSecurityException
-
ChunkedCipherInputStream
public ChunkedCipherInputStream(InputStream stream, long size, int chunkSize, int initialPos) throws GeneralSecurityException - Throws:
GeneralSecurityException
-
-
Method Details
-
initCipherForBlock
- Throws:
IOExceptionGeneralSecurityException
-
read
- Overrides:
readin classFilterInputStream- Throws:
IOException
-
read
- Overrides:
readin classLittleEndianInputStream- Throws:
IOException
-
skip
public long skip(long n) - Overrides:
skipin classFilterInputStream
-
available
public int available()- Specified by:
availablein interfaceLittleEndianInput- Overrides:
availablein classLittleEndianInputStream
-
markSupported
public boolean markSupported()- Overrides:
markSupportedin classFilterInputStream
-
mark
public void mark(int readlimit) - Overrides:
markin classLittleEndianInputStream
-
reset
public void reset()- Overrides:
resetin classLittleEndianInputStream
-
readPlain
public void readPlain(byte[] b, int off, int len) Used when BIFF header fields (sid, size) are being read. The internalCipherinstance must step even when unencrypted bytes are read- Specified by:
readPlainin interfaceLittleEndianInput- Overrides:
readPlainin classLittleEndianInputStream- Parameters:
b- the byte array to receive the bytesoff- the start offset into the byte arraylen- the amount of bytes to fill
-
setNextRecordSize
public void setNextRecordSize(int recordSize) Some ciphers (actually just XOR) are based on the record size, which needs to be set before decryption- Parameters:
recordSize- the size of the next record
-
getPos
public long getPos()- Returns:
- the absolute position in the stream
-