CharBuffer
port of java.nio.CharBuffer
A very simple, mutable (or optionally read-only) character buffer.
This class mimics basic behaviors of a CharBuffer:
Relative get() and put() operations that update the current position.
Absolute get/put via helper methods.
Bulk get/put.
Slicing, duplicating, compacting, and creating a read-only view.
Implements CharSequence (the sequence being the “remaining” characters, i.e. from the current position up to the limit) and Appendable.
Properties
Functions
Returns a read-only view of this buffer.
Clears the buffer: position ← 0, limit ← capacity, mark undefined.
Returns the Unicode code point at the specified index of this CharSequence.
Returns a stream of code point values from this sequence. Any surrogate pairs encountered in the sequence are combined as if by {@linkplain Character#toCodePoint Character.toCodePoint} and the result is passed to the stream. Any other code units, including ordinary BMP characters, unpaired surrogates, and undefined code units, are zero-extended to {@code int} values which are then passed to the stream.
Compacts the buffer by moving the remaining characters to the beginning.
Lexicographically compares the remaining characters of this buffer to another buffer's remaining characters.
Duplicates the buffer, sharing the underlying array and preserving the state.
Flips the buffer: limit ← current position, position ← 0, mark undefined.
Absolute get: returns the char at the given index (0 ≤ index < limit) without changing position.
Tells whether there are any elements between the current position and the limit.
Sets the mark at the current position. After this call, calling reset() will return the position to here.
Relative put: writes the char at current position and increments position.
Relative bulk put method (optional operation).
Absolute put: writes the char at the given index (0 ≤ index < limit) without changing position.
Resets the position to the last mark. Throws IllegalStateException if no mark has been set.
Slices the buffer, creating a new buffer that shares the underlying array and represents the remaining characters (from current position to limit).