- java.lang.Object
-
- java.io.InputStream
-
- org.refcodes.security.DecryptionInputStream
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,org.refcodes.mixin.Disposable
public class DecryptionInputStream extends InputStream implements org.refcodes.mixin.Disposable
ADecryptionInputStream
wraps anInputStream
and consumes input bytes by applying aDecrypter
on each byte read from the providedInputStream
before passing back the processed byte to the caller. The input of theDecryptionInputStream
can be converted back by the accordingEncryptionOutputStream
.
-
-
Constructor Summary
Constructors Constructor Description DecryptionInputStream(InputStream aInputStream, Decrypter<byte[],byte[],DecryptionException> aDecrypter)
Constructs theDecryptionInputStream
by wrapping the givenInputStream
for the providedDecrypter
to be applied on the bytes to be read.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
available()
void
close()
void
dispose()
boolean
equals(Object aObj)
int
hashCode()
void
mark(int aReadlimit)
boolean
markSupported()
int
read()
int
read(byte[] b)
int
read(byte[] b, int off, int len)
void
reset()
long
skip(long aArg0)
String
toString()
-
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
-
-
-
-
Constructor Detail
-
DecryptionInputStream
public DecryptionInputStream(InputStream aInputStream, Decrypter<byte[],byte[],DecryptionException> aDecrypter)
Constructs theDecryptionInputStream
by wrapping the givenInputStream
for the providedDecrypter
to be applied on the bytes to be read.- Parameters:
aInputStream
- TheInputStream
to be wrapped.aDecrypter
- TheDecrypter
to be applied to the bytes to be read.
-
-
Method Detail
-
available
public int available() throws IOException
- Overrides:
available
in classInputStream
- Throws:
IOException
-
mark
public void mark(int aReadlimit)
- Overrides:
mark
in classInputStream
-
markSupported
public boolean markSupported()
- Overrides:
markSupported
in classInputStream
-
read
public int read() throws IOException
- Specified by:
read
in classInputStream
- Throws:
IOException
-
read
public int read(byte[] b) throws IOException
- Overrides:
read
in classInputStream
- Throws:
IOException
-
read
public int read(byte[] b, int off, int len) throws IOException
- Overrides:
read
in classInputStream
- Throws:
IOException
-
reset
public void reset() throws IOException
- Overrides:
reset
in classInputStream
- Throws:
IOException
-
skip
public long skip(long aArg0) throws IOException
- Overrides:
skip
in classInputStream
- Throws:
IOException
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
-
dispose
public void dispose()
- Specified by:
dispose
in interfaceorg.refcodes.mixin.Disposable
-
-