- java.lang.Object
-
- java.io.OutputStream
-
- org.refcodes.io.BijectiveOutputStream
-
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
public class BijectiveOutputStream extends OutputStream
ABijectiveOutputStream
wraps anOutputStream
and produces output bytes by applying aBijectiveFunction
on each byte to be written before delegating the processed vale to the givenOutputStream
. The output of theBijectiveOutputStream
can be converted back by the accordingInverseInputStream
.
-
-
Constructor Summary
Constructors Constructor Description BijectiveOutputStream(OutputStream aOutputStream, org.refcodes.numerical.BijectiveFunction<Byte,Byte> aBijectiveFunction)
Constructs theBijectiveOutputStream
by wrapping the givenOutputStream
for the providedBijectiveFunction
to be applied on the bytes to be written.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
boolean
equals(Object aObj)
void
flush()
int
hashCode()
String
toString()
void
write(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 theBijectiveOutputStream
by wrapping the givenOutputStream
for the providedBijectiveFunction
to be applied on the bytes to be written.- Parameters:
aOutputStream
- TheOutputStream
to be wrapped.aBijectiveFunction
- TheBijectiveFunction
to be applied to the bytes to be written.
-
-
Method Detail
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- Throws:
IOException
-
flush
public void flush() throws IOException
- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
- Throws:
IOException
-
write
public void write(int value) throws IOException
- Specified by:
write
in classOutputStream
- Throws:
IOException
-
-