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:
 java.io.Closeable,java.lang.AutoCloseable,LittleEndianInput
@Internal public abstract class ChunkedCipherInputStream extends LittleEndianInputStream
 
- 
- 
Constructor Summary
Constructors Constructor Description ChunkedCipherInputStream(java.io.InputStream stream, long size, int chunkSize)ChunkedCipherInputStream(java.io.InputStream stream, long size, int chunkSize, int initialPos) 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intavailable()longgetPos()javax.crypto.CipherinitCipherForBlock(int block)voidmark(int readlimit)booleanmarkSupported()intread()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
readByte, readDouble, readFully, readFully, readInt, readLong, readShort, readUByte, readUInt, readUShort 
 - 
 
 - 
 
- 
- 
Constructor Detail
- 
ChunkedCipherInputStream
public ChunkedCipherInputStream(java.io.InputStream stream, long size, int chunkSize) throws java.security.GeneralSecurityException- Throws:
 java.security.GeneralSecurityException
 
- 
ChunkedCipherInputStream
public ChunkedCipherInputStream(java.io.InputStream stream, long size, int chunkSize, int initialPos) throws java.security.GeneralSecurityException- Throws:
 java.security.GeneralSecurityException
 
 - 
 
- 
Method Detail
- 
initCipherForBlock
public final javax.crypto.Cipher initCipherForBlock(int block) throws java.io.IOException, java.security.GeneralSecurityException- Throws:
 java.io.IOExceptionjava.security.GeneralSecurityException
 
- 
read
public int read() throws java.io.IOException- Overrides:
 readin classjava.io.FilterInputStream- Throws:
 java.io.IOException
 
- 
read
public int read(byte[] b, int off, int len) throws java.io.IOException- Overrides:
 readin classjava.io.FilterInputStream- Throws:
 java.io.IOException
 
- 
skip
public long skip(long n)
- Overrides:
 skipin classjava.io.FilterInputStream
 
- 
available
public int available()
- Specified by:
 availablein interfaceLittleEndianInput- Overrides:
 availablein classLittleEndianInputStream
 
- 
markSupported
public boolean markSupported()
- Overrides:
 markSupportedin classjava.io.FilterInputStream
 
- 
mark
public void mark(int readlimit)
- Overrides:
 markin classjava.io.FilterInputStream
 
- 
reset
public void reset()
- Overrides:
 resetin classjava.io.FilterInputStream
 
- 
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
 
 
 - 
 
 -