- java.lang.Object
-
- java.io.InputStream
-
- io.github.mmm.crypto.io.InputStreamWrapper
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
- Direct Known Subclasses:
CryptorInputStream
public class InputStreamWrapper extends InputStream
AnInputStream
that wraps anotherInputStream
to delegate from.- Since:
- 1.0.0
- Author:
- Joerg Hohwiller (hohwille at users.sourceforge.net)
-
-
Constructor Summary
Constructors Constructor Description InputStreamWrapper(InputStream delegate)
The constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
protected InputStream
getDelegate()
int
read()
int
read(byte[] b)
int
read(byte[] b, int off, int len)
protected void
requireNotClosed()
-
Methods inherited from class java.io.InputStream
available, mark, markSupported, nullInputStream, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
-
-
-
-
Constructor Detail
-
InputStreamWrapper
public InputStreamWrapper(InputStream delegate)
The constructor.- Parameters:
delegate
- thedelegate
. May not benull
.
-
-
Method Detail
-
getDelegate
protected InputStream getDelegate()
- Returns:
- the wrapped
InputStream
to delegate from. May not benull
.
-
requireNotClosed
protected void requireNotClosed() throws IOException
- Throws:
IOException
- if the stream has already been closed.
-
read
public int read() throws IOException
- Specified by:
read
in classInputStream
- Throws:
IOException
-
read
public final 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
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
-
-