Some but not all input streams allow you to mark a particular position in the stream, and then return to it. There are three methods that allow this:
public synchronized void mark(int readlimit)
public synchronized void reset() throws IOException
public boolean markSupported()
The boolean markSupported()
method returns true
if this stream supports marking and false
if it doesn't.
Assuming the stream does support marking, the mark()
method places a bookmark in the stream which you can return to later using the reset()
method. There can be only one mark()
in the stream at any given time. Marking a second location erases the first mark. If marking is not supported, these methods throw IOException
s.