|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.flume.serialization.ResettableInputStream
@InterfaceAudience.Public @InterfaceStability.Unstable public abstract class ResettableInputStream
This abstract class defines an interface for which
the stream may be mark
ed and reset
with no limit to
the number of bytes which may have been read between the calls.
Any implementation of this interface guarantees that the mark position will not be invalidated by reading any number of bytes.
Warning: We reserve the right to add public methods to this class in the future. Third-party subclasses beware.
Constructor Summary | |
---|---|
ResettableInputStream()
|
Method Summary | |
---|---|
abstract void |
close()
|
abstract void |
mark()
Marks the current position in this input stream. |
abstract int |
read()
Read a single byte of data from the stream. |
abstract int |
read(byte[] b,
int off,
int len)
Read multiple bytes of data from the stream. |
abstract int |
readChar()
Read a single character. |
abstract void |
reset()
Reset stream position to that set by mark() |
abstract void |
seek(long position)
Seek to the specified byte position in the stream. |
abstract long |
tell()
Tell the current byte position. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ResettableInputStream()
Method Detail |
---|
public abstract int read() throws IOException
-1
if the end of the stream has
been reached.
IOException
public abstract int read(byte[] b, int off, int len) throws IOException
b
- the buffer into which the data is read.off
- Offset into the array b
at which the data is written.len
- the maximum number of bytes to read.
-1
if
the end of the stream has been reached.
IOException
public abstract int readChar() throws IOException
Read a single character.
Note that this may lead to returning only one character in a 2-char surrogate pair sequence. When this happens, the underlying implementation should never persist a mark between two chars of a two-char surrogate pair sequence.
IOException
public abstract void mark() throws IOException
reset
method repositions this stream at the last marked
position so that subsequent reads re-read the same bytes.
Marking a closed stream should not have any effect on the stream.
mark
in interface Resettable
IOException
- If there is an error while setting the mark position.InputStream.mark(int)
,
InputStream.reset()
public abstract void reset() throws IOException
mark()
reset
in interface Resettable
IOException
public abstract void seek(long position) throws IOException
seek
in interface Seekable
position
- Absolute byte offset to seek to
IOException
public abstract long tell() throws IOException
tell
in interface Seekable
IOException
public abstract void close() throws IOException
close
in interface Closeable
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |