java.lang.Object
java.io.InputStream
org.refcodes.io.InverseInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
A
InverseInputStream
wraps an InputStream
and consumes input
bytes by applying a InverseFunction
on each byte read from the
provided InputStream
before passing back the processed byte to the
caller. The input of the InverseInputStream
can be converted back by
the according BijectiveOutputStream
.-
Constructor Summary
ConstructorDescriptionInverseInputStream
(InputStream aInputStream, org.refcodes.numerical.InverseFunction<Byte, Byte> aInverseFunction) Constructs theInverseInputStream
by wrapping the givenInputStream
for the providedInverseFunction
to be applied on the bytes to be read. -
Method Summary
Methods inherited from class java.io.InputStream
nullInputStream, read, read, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Constructor Details
-
InverseInputStream
public InverseInputStream(InputStream aInputStream, org.refcodes.numerical.InverseFunction<Byte, Byte> aInverseFunction) Constructs theInverseInputStream
by wrapping the givenInputStream
for the providedInverseFunction
to be applied on the bytes to be read.- Parameters:
aInputStream
- TheInputStream
to be wrapped.aInverseFunction
- TheInverseFunction
to be applied to the bytes to be read.
-
-
Method Details
-
available
- Overrides:
available
in classInputStream
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
-
equals
-
hashCode
public int hashCode() -
mark
public void mark(int aReadlimit) - Overrides:
mark
in classInputStream
-
markSupported
public boolean markSupported()- Overrides:
markSupported
in classInputStream
-
read
- Specified by:
read
in classInputStream
- Throws:
IOException
-
reset
- Overrides:
reset
in classInputStream
- Throws:
IOException
-
skip
- Overrides:
skip
in classInputStream
- Throws:
IOException
-
toString
-