- java.lang.Object
-
- java.io.OutputStream
-
- org.refcodes.security.EncryptionOutputStream
-
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable,org.refcodes.mixin.Disposable
public class EncryptionOutputStream extends OutputStream implements org.refcodes.mixin.Disposable
AEncryptionOutputStreamwraps anOutputStreamand produces output bytes by applying aEncrypteron each byte to be written before delegating the processed vale to the givenOutputStream. The output of theEncryptionOutputStreamcan be converted back by the accordingDecryptionInputStream.
-
-
Field Summary
Fields Modifier and Type Field Description protected Encrypter<byte[],byte[],EncryptionException>_encrypter
-
Constructor Summary
Constructors Constructor Description EncryptionOutputStream(OutputStream aOutputStream, Encrypter<byte[],byte[],EncryptionException> aEncrypter)Constructs theEncryptionOutputStreamby wrapping the givenOutputStreamfor the providedEncrypterto be applied on the bytes to be written.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voiddispose()booleanequals(Object aObj)voidflush()inthashCode()StringtoString()voidwrite(byte[] b)voidwrite(byte[] b, int off, int len)voidwrite(int value)-
Methods inherited from class java.io.OutputStream
nullOutputStream
-
-
-
-
Field Detail
-
_encrypter
protected Encrypter<byte[],byte[],EncryptionException> _encrypter
-
-
Constructor Detail
-
EncryptionOutputStream
public EncryptionOutputStream(OutputStream aOutputStream, Encrypter<byte[],byte[],EncryptionException> aEncrypter)
Constructs theEncryptionOutputStreamby wrapping the givenOutputStreamfor the providedEncrypterto be applied on the bytes to be written.- Parameters:
aOutputStream- TheOutputStreamto be wrapped.aEncrypter- TheEncrypterto be applied to the bytes to be written.
-
-
Method Detail
-
flush
public void flush() throws IOException- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException
-
write
public void write(int value) throws IOException- Specified by:
writein classOutputStream- Throws:
IOException
-
write
public void write(byte[] b) throws IOException- Overrides:
writein classOutputStream- Throws:
IOException
-
write
public void write(byte[] b, int off, int len) throws IOException- Overrides:
writein classOutputStream- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-
dispose
public void dispose()
- Specified by:
disposein interfaceorg.refcodes.mixin.Disposable
-
-