This class defines four categories of operations upon
character buffers:
Absolute and relative get and
put methods that read and write
single characters;
Relative bulk get
methods that transfer contiguous sequences of characters from this buffer
into an array; and
Relative bulk put
methods that transfer contiguous sequences of characters from a
character array, a string, or some other character
buffer into this buffer; and
Character buffers can be created either by allocation , which allocates space for the buffer's
content, by wrapping an existing
character array or string into a buffer, or by creating a
view of an existing byte buffer.
Like a byte buffer, a character buffer is either direct or non-direct. A
character buffer created via the wrap methods of this class will
be non-direct. A character buffer created as a view of a byte buffer will
be direct if, and only if, the byte buffer itself is direct. Whether or not
a character buffer is direct may be determined by invoking the isDirect method.
This class implements the CharSequence interface so that
character buffers may be used wherever character sequences are accepted, for
example in the regular-expression package java.util.regex.
Methods in this class that do not otherwise have a value to return are
specified to return the buffer upon which they are invoked. This allows
method invocations to be chained.
The sequence of statements
This class defines four categories of operations upon character buffers:
Absolute and relative get
and putmethods that read and write single characters;Relative bulk get
methods that transfer contiguous sequences of characters from this buffer into an array; andRelative bulk put
methods that transfer contiguous sequences of characters from a character array, a string, or some other character buffer into this buffer; andMethods for compacting
, duplicating, and slicinga character buffer.Character buffers can be created either by allocation
, which allocates space for the buffer's content, by wrappingan existing character array or string into a buffer, or by creating a view of an existing byte buffer.Like a byte buffer, a character buffer is either direct or non-direct. A character buffer created via the wrap methods of this class will be non-direct. A character buffer created as a view of a byte buffer will be direct if, and only if, the byte buffer itself is direct. Whether or not a character buffer is direct may be determined by invoking the isDirect method.
This class implements the CharSequence interface so that character buffers may be used wherever character sequences are accepted, for example in the regular-expression package java.util.regex .
Methods in this class that do not otherwise have a value to return are specified to return the buffer upon which they are invoked. This allows method invocations to be chained. The sequence of statements
can, for example, be replaced by the single statement