| java.lang.Object java.io.InputStream it.unimi.dsi.fastutil.io.MeasurableInputStream
All known Subclasses: it.unimi.dsi.fastutil.io.FastByteArrayInputStream, it.unimi.dsi.fastutil.io.FastBufferedInputStream,
MeasurableInputStream | abstract public class MeasurableInputStream extends InputStream (Code) | | An
java.io.InputStream that provides eager access to its length,
and keeps track of the current position (e.g., the number of bytes read so far).
This class adds two methods, both specified as optional. This apparently bizarre
behaviour is necessary because of wrapper classes which use reflection
to support those methods (see, e.g.,
FastBufferedInputStream ).
since: 5.0.4 |
Method Summary | |
abstract public long | length() Returns the overall length of this input stream (optional operation). | abstract public long | position() Returns the current position in this input stream (optional operation). |
length | abstract public long length() throws IOException(Code) | | Returns the overall length of this input stream (optional operation). In most cases, this will require the input
stream to perform some extra action, possibly changing the state of the input stream itself (typically, reading
all the bytes up to the end).
Implementing classes should always document what state will the input stream be in
after calling this method, and which kind of exception could be thrown.
|
position | abstract public long position() throws IOException(Code) | | Returns the current position in this input stream (optional operation).
Usually, the position is just the number of bytes read
since the stream was opened, but in the case of a
it.unimi.dsi.fastutil.io.RepositionableStream it
represent the current position.
|
|
|