@Internal public abstract class ChunkedCipherInputStream extends LittleEndianInputStream
Constructor and Description |
---|
ChunkedCipherInputStream(java.io.InputStream stream,
long size,
int chunkSize) |
ChunkedCipherInputStream(java.io.InputStream stream,
long size,
int chunkSize,
int initialPos) |
Modifier and Type | Method and Description |
---|---|
int |
available() |
protected byte[] |
getChunk() |
protected int |
getChunkMask() |
protected byte[] |
getPlain() |
long |
getPos() |
protected abstract javax.crypto.Cipher |
initCipherForBlock(javax.crypto.Cipher existing,
int block) |
javax.crypto.Cipher |
initCipherForBlock(int block) |
protected int |
invokeCipher(int totalBytes,
boolean doFinal)
Helper function for overriding the cipher invocation, i.e.
|
void |
mark(int readlimit) |
boolean |
markSupported() |
int |
read() |
int |
read(byte[] b,
int off,
int len) |
void |
readPlain(byte[] b,
int off,
int len)
Used when BIFF header fields (sid, size) are being read.
|
void |
reset() |
void |
setNextRecordSize(int recordSize)
Some ciphers (actually just XOR) are based on the record size,
which needs to be set before decryption
|
long |
skip(long n) |
getReadIndex, readByte, readDouble, readFloat, readFully, readFully, readInt, readLong, readShort, readUByte, readUInt, readUShort, skipFully
public ChunkedCipherInputStream(java.io.InputStream stream, long size, int chunkSize) throws java.security.GeneralSecurityException
java.security.GeneralSecurityException
public ChunkedCipherInputStream(java.io.InputStream stream, long size, int chunkSize, int initialPos) throws java.security.GeneralSecurityException
java.security.GeneralSecurityException
public final javax.crypto.Cipher initCipherForBlock(int block) throws java.io.IOException, java.security.GeneralSecurityException
java.io.IOException
java.security.GeneralSecurityException
protected abstract javax.crypto.Cipher initCipherForBlock(javax.crypto.Cipher existing, int block) throws java.security.GeneralSecurityException
java.security.GeneralSecurityException
public int read() throws java.io.IOException
read
in class java.io.FilterInputStream
java.io.IOException
public int read(byte[] b, int off, int len) throws java.io.IOException
read
in class LittleEndianInputStream
java.io.IOException
public long skip(long n)
skip
in class java.io.FilterInputStream
public int available()
available
in interface LittleEndianInput
available
in class LittleEndianInputStream
public boolean markSupported()
markSupported
in class java.io.FilterInputStream
public void mark(int readlimit)
mark
in class LittleEndianInputStream
public void reset()
reset
in class LittleEndianInputStream
protected int getChunkMask()
protected int invokeCipher(int totalBytes, boolean doFinal) throws java.security.GeneralSecurityException
java.security.GeneralSecurityException
public void readPlain(byte[] b, int off, int len)
Cipher
instance must step even when unencrypted bytes are readreadPlain
in interface LittleEndianInput
readPlain
in class LittleEndianInputStream
b
- the byte array to receive the bytesoff
- the start offset into the byte arraylen
- the amount of bytes to fillpublic void setNextRecordSize(int recordSize)
recordSize
- the size of the next recordprotected byte[] getChunk()
protected byte[] getPlain()
public long getPos()
Copyright 2022 The Apache Software Foundation or its licensors, as applicable.