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:
java.io.Closeable
,java.io.Flushable
,java.lang.AutoCloseable
@Internal public abstract class ChunkedCipherOutputStream extends java.io.FilterOutputStream
-
-
Constructor Summary
Constructors Constructor Description ChunkedCipherOutputStream(java.io.OutputStream stream, int chunkSize)
ChunkedCipherOutputStream(DirectoryNode dir, int chunkSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
javax.crypto.Cipher
initCipherForBlock(int block, boolean lastChunk)
void
setNextRecordSize(int recordSize, boolean isPlain)
Some ciphers (actually just XOR) are based on the record size, which needs to be set before encryptionvoid
write(byte[] b)
void
write(byte[] b, int off, int len)
void
write(int b)
void
writePlain(byte[] b, int off, int len)
-
-
-
Constructor Detail
-
ChunkedCipherOutputStream
public ChunkedCipherOutputStream(DirectoryNode dir, int chunkSize) throws java.io.IOException, java.security.GeneralSecurityException
- Throws:
java.io.IOException
java.security.GeneralSecurityException
-
ChunkedCipherOutputStream
public ChunkedCipherOutputStream(java.io.OutputStream stream, int chunkSize) throws java.io.IOException, java.security.GeneralSecurityException
- Throws:
java.io.IOException
java.security.GeneralSecurityException
-
-
Method Detail
-
initCipherForBlock
public final javax.crypto.Cipher initCipherForBlock(int block, boolean lastChunk) throws java.io.IOException, java.security.GeneralSecurityException
- Throws:
java.io.IOException
java.security.GeneralSecurityException
-
write
public void write(int b) throws java.io.IOException
- Overrides:
write
in classjava.io.FilterOutputStream
- Throws:
java.io.IOException
-
write
public void write(byte[] b) throws java.io.IOException
- Overrides:
write
in classjava.io.FilterOutputStream
- Throws:
java.io.IOException
-
write
public void write(byte[] b, int off, int len) throws java.io.IOException
- Overrides:
write
in classjava.io.FilterOutputStream
- Throws:
java.io.IOException
-
writePlain
public void writePlain(byte[] b, int off, int len) throws java.io.IOException
- 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.FilterOutputStream
- Throws:
java.io.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
-true
if the record is unencrypted
-
-