Build 1.0_r1(from source)

java.nio
Class BaseByteBuffer

java.lang.Object
  extended by java.nio.Buffer
      extended by java.nio.ByteBuffer
          extended by java.nio.BaseByteBuffer
All Implemented Interfaces:
Comparable<ByteBuffer>
Direct Known Subclasses:
DirectByteBuffer, HeapByteBuffer

abstract class BaseByteBuffer
extends ByteBuffer

Serves as the root of other byte buffer impl classes, implements common methods that can be shared by child classes.


Field Summary
 
Fields inherited from class java.nio.ByteBuffer
order
 
Fields inherited from class java.nio.Buffer
_elementSizeShift, capacity, limit, mark, position, UNSET_MARK
 
Constructor Summary
protected BaseByteBuffer(int capacity)
           
 
Method Summary
 CharBuffer asCharBuffer()
          Returns a char buffer which is based on the remaining content of this byte buffer.
 DoubleBuffer asDoubleBuffer()
          Returns a double buffer which is based on the remaining content of this byte buffer.
 FloatBuffer asFloatBuffer()
          Returns a float buffer which is based on the remaining content of this byte buffer.
 IntBuffer asIntBuffer()
          Returns a int buffer which is based on the remaining content of this byte buffer.
 LongBuffer asLongBuffer()
          Returns a long buffer which is based on the remaining content of this byte buffer.
 ShortBuffer asShortBuffer()
          Returns a short buffer which is based on the remaining content of this byte buffer.
 char getChar()
          Returns the char at the current position and increase the position by 2.
 char getChar(int index)
          Returns the char at the specified index.
 ByteBuffer putChar(char value)
          Writes the given char to the current position and increase the position by 2.
 ByteBuffer putChar(int index, char value)
          Write a char to the specified index of this buffer.
 
Methods inherited from class java.nio.ByteBuffer
_array, _arrayOffset, allocate, allocateDirect, array, arrayOffset, asReadOnlyBuffer, compact, compareTo, duplicate, equals, get, get, get, get, getDouble, getDouble, getFloat, getFloat, getInt, getInt, getLong, getLong, getShort, getShort, hasArray, hashCode, isDirect, order, order, orderImpl, protectedArray, protectedArrayOffset, protectedHasArray, put, put, put, put, put, putDouble, putDouble, putFloat, putFloat, putInt, putInt, putLong, putLong, putShort, putShort, slice, toString, wrap, wrap
 
Methods inherited from class java.nio.Buffer
capacity, clear, flip, hasRemaining, isReadOnly, limit, limit, mark, position, position, remaining, reset, rewind
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BaseByteBuffer

protected BaseByteBuffer(int capacity)
Method Detail

asCharBuffer

public final CharBuffer asCharBuffer()
Description copied from class: ByteBuffer
Returns a char buffer which is based on the remaining content of this byte buffer.

The new buffer's position is zero, its limit and capacity is the number of remaining bytes divided by two, and its mark is not set. The new buffer's readonly property and byte order are same as this buffer. The new buffer is direct, if this byte buffer is direct.

The new buffer shares content with this buffer, which means either buffer's change of content will be visible to the other. The two buffer's position, limit and mark are independent.

Specified by:
asCharBuffer in class ByteBuffer
Returns:
A char buffer which is based on the content of this byte buffer.

asDoubleBuffer

public final DoubleBuffer asDoubleBuffer()
Description copied from class: ByteBuffer
Returns a double buffer which is based on the remaining content of this byte buffer.

The new buffer's position is zero, its limit and capacity is the number of remaining bytes divided by two, and its mark is not set. The new buffer's readonly property and byte order are same as this buffer. The new buffer is direct, if this byte buffer is direct.

The new buffer shares content with this buffer, which means either buffer's change of content will be visible to the other. The two buffer's position, limit and mark are independent.

Specified by:
asDoubleBuffer in class ByteBuffer
Returns:
A double buffer which is based on the content of this byte buffer.

asFloatBuffer

public final FloatBuffer asFloatBuffer()
Description copied from class: ByteBuffer
Returns a float buffer which is based on the remaining content of this byte buffer.

The new buffer's position is zero, its limit and capacity is the number of remaining bytes divided by two, and its mark is not set. The new buffer's readonly property and byte order are same as this buffer. The new buffer is direct, if this byte buffer is direct.

The new buffer shares content with this buffer, which means either buffer's change of content will be visible to the other. The two buffer's position, limit and mark are independent.

Specified by:
asFloatBuffer in class ByteBuffer
Returns:
A float buffer which is based on the content of this byte buffer.

asIntBuffer

public final IntBuffer asIntBuffer()
Description copied from class: ByteBuffer
Returns a int buffer which is based on the remaining content of this byte buffer.

The new buffer's position is zero, its limit and capacity is the number of remaining bytes divided by two, and its mark is not set. The new buffer's readonly property and byte order are same as this buffer. The new buffer is direct, if this byte buffer is direct.

The new buffer shares content with this buffer, which means either buffer's change of content will be visible to the other. The two buffer's position, limit and mark are independent.

Specified by:
asIntBuffer in class ByteBuffer
Returns:
A int buffer which is based on the content of this byte buffer.

asLongBuffer

public final LongBuffer asLongBuffer()
Description copied from class: ByteBuffer
Returns a long buffer which is based on the remaining content of this byte buffer.

The new buffer's position is zero, its limit and capacity is the number of remaining bytes divided by two, and its mark is not set. The new buffer's readonly property and byte order are same as this buffer. The new buffer is direct, if this byte buffer is direct.

The new buffer shares content with this buffer, which means either buffer's change of content will be visible to the other. The two buffer's position, limit and mark are independent.

Specified by:
asLongBuffer in class ByteBuffer
Returns:
A long buffer which is based on the content of this byte buffer.

asShortBuffer

public final ShortBuffer asShortBuffer()
Description copied from class: ByteBuffer
Returns a short buffer which is based on the remaining content of this byte buffer.

The new buffer's position is zero, its limit and capacity is the number of remaining bytes divided by two, and its mark is not set. The new buffer's readonly property and byte order are same as this buffer. The new buffer is direct, if this byte buffer is direct.

The new buffer shares content with this buffer, which means either buffer's change of content will be visible to the other. The two buffer's position, limit and mark are independent.

Specified by:
asShortBuffer in class ByteBuffer
Returns:
A short buffer which is based on the content of this byte buffer.

getChar

public final char getChar()
Description copied from class: ByteBuffer
Returns the char at the current position and increase the position by 2.

The 2 bytes start from the current position are composed into a char according to current byte order and returned. The position increases by 2.

Specified by:
getChar in class ByteBuffer
Returns:
The char at the current position.

getChar

public final char getChar(int index)
Description copied from class: ByteBuffer
Returns the char at the specified index.

The 2 bytes start from the specified index are composed into a char according to current byte order and returned. The position is not changed.

Specified by:
getChar in class ByteBuffer
Parameters:
index - The index, must be no less than zero and equal or less than limit - 2
Returns:
The char at the specified index.

putChar

public final ByteBuffer putChar(char value)
Description copied from class: ByteBuffer
Writes the given char to the current position and increase the position by 2.

The char is converted to bytes using the current byte order.

Specified by:
putChar in class ByteBuffer
Parameters:
value - The char to write
Returns:
This buffer

putChar

public final ByteBuffer putChar(int index,
                                char value)
Description copied from class: ByteBuffer
Write a char to the specified index of this buffer.

The char is converted to bytes using the current byte order. The position is not changed.

Specified by:
putChar in class ByteBuffer
Parameters:
index - The index, must be no less than zero and equal or less than limit - 2
value - The char to write
Returns:
This buffer

Build 1.0_r1(from source)

Please submit a feedback, bug or feature