Like input streams, buffers can be marked and reset using the mark( ) and reset( ) methods:
public final Buffer mark( ) public final Buffer reset( ) throws InvalidMarkException
Initially, the mark is unset. Invoking the buffer's mark( ) method places the mark at the buffer's current position. Resetting returns the position to the previous mark. Unlike with InputStream, there's no markSupported( ) method. All buffers support marking and resetting.
The mark is always less than or equal to the position and the limit. If either the limit or the position is set to a value less than the current mark, the mark is cleared. Resetting when there's no mark throws an InvalidMarkException.
Basic I/O
Introducing I/O
Output Streams
Input Streams
Data Sources
File Streams
Network Streams
Filter Streams
Filter Streams
Print Streams
Data Streams
Streams in Memory
Compressing Streams
JAR Archives
Cryptographic Streams
Object Serialization
New I/O
Buffers
Channels
Nonblocking I/O
The File System
Working with Files
File Dialogs and Choosers
Text
Character Sets and Unicode
Readers and Writers
Formatted I/O with java.text
Devices
The Java Communications API
USB
The J2ME Generic Connection Framework
Bluetooth
Character Sets