- java.lang.Object
-
- java.io.InputStream
-
- org.refcodes.io.InverseInputStream
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public class InverseInputStream extends InputStream
AInverseInputStreamwraps anInputStreamand consumes input bytes by applying aInverseFunctionon each byte read from the providedInputStreambefore passing back the processed byte to the caller. The input of theInverseInputStreamcan be converted back by the accordingBijectiveOutputStream.
-
-
Constructor Summary
Constructors Constructor Description InverseInputStream(InputStream aInputStream, org.refcodes.numerical.InverseFunction<Byte,Byte> aInverseFunction)Constructs theInverseInputStreamby wrapping the givenInputStreamfor the providedInverseFunctionto be applied on the bytes to be read.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intavailable()voidclose()booleanequals(Object aObj)inthashCode()voidmark(int aReadlimit)booleanmarkSupported()intread()voidreset()longskip(long aArg0)StringtoString()-
Methods inherited from class java.io.InputStream
nullInputStream, read, read, readAllBytes, readNBytes, readNBytes, transferTo
-
-
-
-
Constructor Detail
-
InverseInputStream
public InverseInputStream(InputStream aInputStream, org.refcodes.numerical.InverseFunction<Byte,Byte> aInverseFunction)
Constructs theInverseInputStreamby wrapping the givenInputStreamfor the providedInverseFunctionto be applied on the bytes to be read.- Parameters:
aInputStream- TheInputStreamto be wrapped.aInverseFunction- TheInverseFunctionto be applied to the bytes to be read.
-
-
Method Detail
-
available
public int available() throws IOException- Overrides:
availablein classInputStream- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
mark
public void mark(int aReadlimit)
- Overrides:
markin classInputStream
-
markSupported
public boolean markSupported()
- Overrides:
markSupportedin classInputStream
-
read
public int read() throws IOException- Specified by:
readin classInputStream- Throws:
IOException
-
reset
public void reset() throws IOException- Overrides:
resetin classInputStream- Throws:
IOException
-
skip
public long skip(long aArg0) throws IOException- Overrides:
skipin classInputStream- Throws:
IOException
-
-