Class RFileCipherOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- java.io.FilterOutputStream
-
- javax.crypto.CipherOutputStream
-
- org.apache.accumulo.core.crypto.streams.RFileCipherOutputStream
-
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
public class RFileCipherOutputStream extends CipherOutputStream
This class extendsCipherOutputStream
to include a way to track the number of bytes that have been encrypted by the stream. The write method also includes a mechanism to stop writing and throw an exception if exceeding a maximum number of bytes is attempted.
-
-
Field Summary
-
Fields inherited from class java.io.FilterOutputStream
out
-
-
Constructor Summary
Constructors Constructor Description RFileCipherOutputStream(OutputStream os, Cipher c)
Constructs a RFileCipherOutputStream
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
write(byte[] b)
void
write(byte[] b, int off, int len)
Override of CipherOutputStream's write to count the number of bytes that have been encrypted.void
write(int b)
Override of CipherOutputStream's write for a single byte to count it.-
Methods inherited from class javax.crypto.CipherOutputStream
close, flush
-
Methods inherited from class java.io.OutputStream
nullOutputStream
-
-
-
-
Constructor Detail
-
RFileCipherOutputStream
public RFileCipherOutputStream(OutputStream os, Cipher c)
Constructs a RFileCipherOutputStream- Parameters:
os
- the OutputStream objectc
- an initialized Cipher object
-
-
Method Detail
-
write
public void write(byte[] b, int off, int len) throws IOException
Override of CipherOutputStream's write to count the number of bytes that have been encrypted. This method now throws an exception if an attempt to write bytes beyond a maximum is made.- Overrides:
write
in classCipherOutputStream
- Throws:
IOException
-
write
public void write(byte[] b) throws IOException
- Overrides:
write
in classCipherOutputStream
- Throws:
IOException
-
write
public void write(int b) throws IOException
Override of CipherOutputStream's write for a single byte to count it. This method now throws an exception if an attempt to write bytes beyond a maximum is made.- Overrides:
write
in classCipherOutputStream
- Throws:
IOException
-
-