Package org.apache.poi.poifs.crypt
Class ChunkedCipherOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- java.io.FilterOutputStream
-
- org.apache.poi.poifs.crypt.ChunkedCipherOutputStream
-
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
@Internal public abstract class ChunkedCipherOutputStream extends FilterOutputStream
-
-
Constructor Summary
Constructors Constructor Description ChunkedCipherOutputStream(OutputStream stream, int chunkSize)ChunkedCipherOutputStream(DirectoryNode dir, int chunkSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()CipherinitCipherForBlock(int block, boolean lastChunk)voidsetNextRecordSize(int recordSize, boolean isPlain)Some ciphers (actually just XOR) are based on the record size, which needs to be set before encryptionvoidwrite(byte[] b)voidwrite(byte[] b, int off, int len)voidwrite(int b)voidwritePlain(byte[] b, int off, int len)-
Methods inherited from class java.io.FilterOutputStream
flush
-
Methods inherited from class java.io.OutputStream
nullOutputStream
-
-
-
-
Constructor Detail
-
ChunkedCipherOutputStream
public ChunkedCipherOutputStream(DirectoryNode dir, int chunkSize) throws IOException, GeneralSecurityException
- Throws:
IOExceptionGeneralSecurityException
-
ChunkedCipherOutputStream
public ChunkedCipherOutputStream(OutputStream stream, int chunkSize) throws IOException, GeneralSecurityException
- Throws:
IOExceptionGeneralSecurityException
-
-
Method Detail
-
initCipherForBlock
public final Cipher initCipherForBlock(int block, boolean lastChunk) throws IOException, GeneralSecurityException
- Throws:
IOExceptionGeneralSecurityException
-
write
public void write(int b) throws IOException- Overrides:
writein classFilterOutputStream- Throws:
IOException
-
write
public void write(byte[] b) throws IOException- Overrides:
writein classFilterOutputStream- Throws:
IOException
-
write
public void write(byte[] b, int off, int len) throws IOException- Overrides:
writein classFilterOutputStream- Throws:
IOException
-
writePlain
public void writePlain(byte[] b, int off, int len) throws IOException- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classFilterOutputStream- Throws:
IOException
-
setNextRecordSize
public void setNextRecordSize(int recordSize, boolean isPlain)Some ciphers (actually just XOR) are based on the record size, which needs to be set before encryption- Parameters:
recordSize- the size of the next recordisPlain-trueif the record is unencrypted
-
-