- java.lang.Object
-
- java.io.OutputStream
-
- org.refcodes.io.BijectiveOutputStream
-
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
public class BijectiveOutputStream extends OutputStream
ABijectiveOutputStreamwraps anOutputStreamand produces output bytes by applying aBijectiveFunctionon each byte to be written before delegating the processed vale to the givenOutputStream. The output of theBijectiveOutputStreamcan be converted back by the accordingInverseInputStream.
-
-
Constructor Summary
Constructors Constructor Description BijectiveOutputStream(OutputStream aOutputStream, org.refcodes.numerical.BijectiveFunction<Byte,Byte> aBijectiveFunction)Constructs theBijectiveOutputStreamby wrapping the givenOutputStreamfor the providedBijectiveFunctionto be applied on the bytes to be written.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()booleanequals(Object aObj)voidflush()inthashCode()StringtoString()voidwrite(int value)-
Methods inherited from class java.io.OutputStream
nullOutputStream, write, write
-
-
-
-
Constructor Detail
-
BijectiveOutputStream
public BijectiveOutputStream(OutputStream aOutputStream, org.refcodes.numerical.BijectiveFunction<Byte,Byte> aBijectiveFunction)
Constructs theBijectiveOutputStreamby wrapping the givenOutputStreamfor the providedBijectiveFunctionto be applied on the bytes to be written.- Parameters:
aOutputStream- TheOutputStreamto be wrapped.aBijectiveFunction- TheBijectiveFunctionto be applied to the bytes to be written.
-
-
Method Detail
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-
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
-
-