public class CachedInputStream extends FilterInputStream
InputStream that wrapps another InputStream and
caches all read bytes.
The bytes read so far are returned by getCachedBytes().
| Modifier and Type | Field and Description |
|---|---|
protected ByteArrayOutputStream |
buffer
The buffer for the cached bytes.
|
in| Constructor and Description |
|---|
CachedInputStream(InputStream in)
Creates a
CachedInputStream that wrapps the given InputStream. |
| Modifier and Type | Method and Description |
|---|---|
byte[] |
getCachedBytes()
Returns a copy of all the bytes read from this
CachedInputStream so far. |
int |
read() |
int |
read(byte[] b,
int off,
int len) |
available, close, mark, markSupported, read, reset, skipprotected ByteArrayOutputStream buffer
public CachedInputStream(InputStream in)
CachedInputStream that wrapps the given InputStream.in - the wrapped InputStreampublic int read()
throws IOException
read in class FilterInputStreamIOExceptionInputStream.read()public int read(byte[] b,
int off,
int len)
throws IOException
read in class FilterInputStreamIOExceptionInputStream.read(byte[], int, int)public byte[] getCachedBytes()
CachedInputStream so far.© 2002-2005 IAIK, © 2004, 2006 - 2019 Stiftung SIC