Index (Frames) | Index (No Frames) | Package | Package Tree | Tree
java.nio

Class CharBuffer

java.lang.Object
|
+--java.nio.Buffer
   |
   +--java.nio.CharBuffer

All Implemented Interfaces:

Comparable, CharSequence


public abstract class CharBuffer

extends Buffer

implements Comparable, CharSequence

Since:

Field Summary

intarray_offset

char[]backing_buffer

Method Summary

static java.nio.CharBufferallocate(int capacity)

Allocats a non-direct character buffer.
char[]array()

Retrieves the backing buffer.
intarrayOffset()

Returns the offset within this buffer's backing array of the first element of the buffer.
java.nio.CharBufferasReadOnlyBuffer()

Creates a new, read-only character buffer that shares this buffer's content.
charcharAt(int index)

Reads the character at the given index relative to the current position.
java.nio.CharBuffercompact()

Compacts this buffer.
intcompareTo(java.lang.Object obj)

Compares this buffer to another object.
java.nio.CharBufferduplicate()

Creates a new character buffer that shares this buffer's content.
booleanequals(java.lang.Object obj)

Tells whether or not this buffer is equal to another object.
java.nio.CharBufferget(char[] dst, int offset, int length)

Relative bulk get method.
java.nio.CharBufferget(char[] dst)

Relative bulk get method.
charget()

Relative bulk get method.
charget(int index)

Absolute bulk get method.
booleanhasArray()

Tells wether this buffer has a backing array or not.
inthashCode()

Returns the current hash code of this buffer.
booleanisDirect()

Tells wether or not this is a direct buffer.
intlength()

Returns the length of this character buffer.
java.nio.ByteOrderorder()

Retrieves the current endianess of this buffer.
java.nio.CharBufferput(java.nio.CharBuffer src)

Relative bulk put method.
java.nio.CharBufferput(char[] src, int offset, int length)

Relative bulk put method.
java.nio.CharBufferput(java.lang.String src, int offset, int length)

Relative bulk put method.
java.nio.CharBufferput(java.lang.String src)

Relative bulk put method.
java.nio.CharBufferput(char[] src)

This method transfers the entire content of the given source character array into this buffer.
java.nio.CharBufferput(char b)

Relative bulk get method.
java.nio.CharBufferput(int index, char b)

Absolute bulk put method.
java.nio.CharBufferslice()

Creates a new character buffer whose content is a shared subsequence of this buffer's content.
java.lang.CharSequencesubSequence(int start, int end)

Creates a new character buffer that represents the specified subsequence of this buffer, relative to the current position.
java.lang.StringtoString()

Retrieves the content of the character buffer as string.
static java.nio.CharBufferwrap(char[] array, int offset, int length)

Wraps a character array into a buffer.
static java.nio.CharBufferwrap(char[] array)

Wraps a character array into a buffer.
static java.nio.CharBufferwrap(java.lang.CharSequence cs, int offset, int length)

Wraps a character sequence into a buffer.
static java.nio.CharBufferwrap(java.lang.CharSequence cs)

Wraps a character sequence into a buffer.

Field Details

array_offset

protected int array_offset


backing_buffer

protected char[] backing_buffer


Method Details

allocate

public static CharBuffer allocate(int capacity)

Allocats a non-direct character buffer.

Parameters:


array

public final char[] array()

Retrieves the backing buffer.

Throws:


arrayOffset

public final int arrayOffset()

Returns the offset within this buffer's backing array of the first element of the buffer.

Throws:


asReadOnlyBuffer

public CharBuffer asReadOnlyBuffer()

Creates a new, read-only character buffer that shares this buffer's content.


charAt

public final char charAt(int index)

Reads the character at the given index relative to the current position.

Parameters:

Throws:


compact

public CharBuffer compact()

Compacts this buffer.

Throws:


compareTo

public int compareTo(java.lang.Object obj)

Compares this buffer to another object.

Parameters:

Throws:


duplicate

public CharBuffer duplicate()

Creates a new character buffer that shares this buffer's content.


equals

public boolean equals(java.lang.Object obj)

Tells whether or not this buffer is equal to another object.

Parameters:


get

public char get()

Relative bulk get method.

Throws:


get

public CharBuffer get(char[] dst)

Relative bulk get method.

Parameters:

Throws:


get

public CharBuffer get(char[] dst, int offset, int length)

Relative bulk get method.

Parameters:

Throws:


get

public char get(int index)

Absolute bulk get method.

Parameters:

Throws:


hasArray

public final boolean hasArray()

Tells wether this buffer has a backing array or not.


hashCode

public int hashCode()

Returns the current hash code of this buffer.


isDirect

public boolean isDirect()

Tells wether or not this is a direct buffer.


length

public final int length()

Returns the length of this character buffer.


order

public ByteOrder order()

Retrieves the current endianess of this buffer.


put

public final CharBuffer put(char[] src)

This method transfers the entire content of the given source character array into this buffer.

Parameters:

Throws:


put

public CharBuffer put(char b)

Relative bulk get method.

Parameters:

Throws:


put

public CharBuffer put(char[] src, int offset, int length)

Relative bulk put method.

Parameters:

Throws:


put

public CharBuffer put(int index, char b)

Absolute bulk put method.

Parameters:

Throws:


put

public final CharBuffer put(java.lang.String src)

Relative bulk put method.

Parameters:

Throws:


put

public CharBuffer put(java.lang.String src, int offset, int length)

Relative bulk put method.

Parameters:

Throws:


put

public CharBuffer put(java.nio.CharBuffer src)

Relative bulk put method.

Parameters:

Throws:


slice

public CharBuffer slice()

Creates a new character buffer whose content is a shared subsequence of this buffer's content.


subSequence

public CharSequence subSequence(int start, int end)

Creates a new character buffer that represents the specified subsequence of this buffer, relative to the current position.

Parameters:

Throws:


toString

public String toString()

Retrieves the content of the character buffer as string.


wrap

public static final CharBuffer wrap(char[] array)

Wraps a character array into a buffer.

Parameters:


wrap

public static final CharBuffer wrap(char[] array, int offset, int length)

Wraps a character array into a buffer.

Parameters:

Throws:


wrap

public static final CharBuffer wrap(java.lang.CharSequence cs)

Wraps a character sequence into a buffer.

Parameters:


wrap

public static final CharBuffer wrap(java.lang.CharSequence cs, int offset, int length)

Wraps a character sequence into a buffer.

Parameters:

Throws: