public class MeasuredInputStream extends InputStream
InputStream relays information from an underlying
InputStream while measuring how many bytes have been read or skipped.
Note marking is not supported in this object.
| Constructor and Description |
|---|
MeasuredInputStream(InputStream
|
| Modifier and Type | Method and Description |
|---|---|
int |
available()
|
void |
close()
|
long |
getReadBytes()
Returns the number of bytes that have been read (or skipped).
|
boolean |
isCloseable()
|
void |
mark(int readlimit)
|
boolean |
markSupported()
|
int |
read()
|
int |
read(byte[] b)
|
int |
read(byte[] b, int off, int len)
|
void |
reset()
|
void |
seek(long pos)
This skips forward to the requested position.
|
void |
setCloseable(boolean b)
Control whether calling
close() affects the underlying InputStream.
|
long |
skip(long n)
|
public MeasuredInputStream(InputStreami)
public void setCloseable(boolean b)
close() affects the underlying InputStream. This is useful in cases when you pass an InputStream to a 3rd party decoder that helpfully tries to close the stream as it wraps up, but there is still data to be read later (such as when working with a ZipInputStream).
b - whether calling
close() will close the underlying InputStream.
public boolean isCloseable()
public int available()
throws IOException
available in class
InputStream
IOException
public long getReadBytes()
public void close()
throws IOException
close in interface
Closeable
close in interface
AutoCloseable
close in class
InputStream
IOException
public void mark(int readlimit)
public boolean markSupported()
public int read()
throws IOException
read in class
InputStream
IOException
public int read(byte[] b,
int off,
int len)
throws IOException
read in class
InputStream
IOException
public int read(byte[] b)
throws IOException
read in class
InputStream
IOException
public void reset()
throws IOException
reset in class
InputStream
IOException
public long skip(long n)
throws IOException
skip in class
InputStream
IOException
public void seek(long pos)
throws IOException
pos -
IOException -