GNU Classpath (0.19) | ||
Prev Class | Next Class | Frames | No Frames | |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
java.nio.Buffer
java.nio.ByteBuffer
Method Summary | |
static ByteBuffer |
|
static ByteBuffer |
|
byte[] |
|
int |
|
CharBuffer |
|
DoubleBuffer |
|
FloatBuffer |
|
IntBuffer |
|
LongBuffer |
|
ByteBuffer |
|
ShortBuffer |
|
ByteBuffer |
|
int | |
ByteBuffer |
|
boolean | |
byte |
|
ByteBuffer |
|
ByteBuffer |
|
byte |
|
char |
|
char |
|
double |
|
double |
|
float |
|
float |
|
int |
|
int |
|
long |
|
long |
|
short |
|
short |
|
boolean |
|
int |
|
boolean |
|
ByteOrder |
|
ByteBuffer | |
ByteBuffer |
|
ByteBuffer |
|
ByteBuffer |
|
ByteBuffer |
|
ByteBuffer |
|
ByteBuffer |
|
ByteBuffer |
|
ByteBuffer |
|
ByteBuffer |
|
ByteBuffer |
|
ByteBuffer |
|
ByteBuffer |
|
ByteBuffer |
|
ByteBuffer |
|
ByteBuffer |
|
ByteBuffer |
|
ByteBuffer |
|
ByteBuffer |
|
String |
|
static ByteBuffer |
|
static ByteBuffer |
|
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 , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait |
public static ByteBuffer allocate(int capacity)
Allocates a newByteBuffer
object with a given capacity.
public static ByteBuffer allocateDirect(int capacity)
Allocates a new direct byte buffer.
public final byte[] array()
Returns thebyte
array that backs this buffer.
- Throws:
ReadOnlyBufferException
- If this buffer is read-only.UnsupportedOperationException
- If this buffer is not backed by an accessible array.
public final int arrayOffset()
Returns the offset within this buffer's backing array of the first element.
- Throws:
ReadOnlyBufferException
- If this buffer is read-only.UnsupportedOperationException
- If this buffer is not backed by an accessible array.
public DoubleBuffer asDoubleBuffer()
Creates a view of this byte buffer as a double buffer.
public FloatBuffer asFloatBuffer()
Creates a view of this byte buffer as a float buffer.
public ByteBuffer asReadOnlyBuffer()
Creates a new read-onlyByteBuffer
that shares this buffer's content.
public ShortBuffer asShortBuffer()
Creates a view of this byte buffer as a short buffer.
public ByteBuffer compact()
Compacts this buffer.
- Throws:
ReadOnlyBufferException
- If this buffer is read-only.
public int compareTo(Object obj)
Compares twoByteBuffer
objects.
- Specified by:
- compareTo in interface Comparable
- Throws:
ClassCastException
- If obj is not an object derived fromByteBuffer
.
public boolean equals(Object obj)
Checks if this buffer is equal to obj.
- Overrides:
- equals in interface Object
public byte get()
Reads thebyte
at this buffer's current position, and then increments the position.
- Throws:
BufferUnderflowException
- If there are no remainingbyte
s in this buffer.
public ByteBuffer get(byte[] dst)
This method transfersbyte
s from this buffer into the given destination array.
- Parameters:
dst
- The byte array to write into.
- Throws:
BufferUnderflowException
- If there are fewer than dst.lengthbyte
s remaining in this buffer.
public ByteBuffer get(byte[] dst, int offset, int length)
This method transfersbyte
s from this buffer into the given destination array. Before the transfer, it checks if there are fewer than lengthbyte
s remaining in this buffer.
- Parameters:
dst
- The destination arrayoffset
- The offset within the array of the firstbyte
to be written; must be non-negative and no larger than dst.length.length
- The maximum number of bytes to be written to the given array; must be non-negative and no larger than dst.length - offset.
- Throws:
BufferUnderflowException
- If there are fewer than lengthbyte
s remaining in this buffer.IndexOutOfBoundsException
- If the preconditions on the offset and length parameters do not hold.
public byte get(int index)
Absolute get method.
- Throws:
IndexOutOfBoundsException
- If index is negative or not smaller than the buffer's limit.
public char getChar()
Relative get method for reading a character value.
- Throws:
BufferUnderflowException
- If there are fewer than two bytes remaining in this buffer.
public char getChar(int index)
Absolute get method for reading a character value.
- Throws:
IndexOutOfBoundsException
- If there are fewer than two bytes remaining in this buffer
public double getDouble()
Relative get method for reading a double value.
- Throws:
BufferUnderflowException
- If there are fewer than eight bytes remaining in this buffer.
public double getDouble(int index)
Absolute get method for reading a double value.
- Throws:
IndexOutOfBoundsException
- If index is negative or not smaller than the buffer's limit, minus seven.
public float getFloat()
Relative get method for reading a float value.
- Throws:
BufferUnderflowException
- If there are fewer than four bytes remaining in this buffer.
public float getFloat(int index)
Absolute get method for reading a float value.
- Throws:
IndexOutOfBoundsException
- If index is negative or not smaller than the buffer's limit, minus three.
public int getInt()
Relative get method for reading an integer value.
- Throws:
BufferUnderflowException
- If there are fewer than four bytes remaining in this buffer.
public int getInt(int index)
Absolute get method for reading an integer value.
- Throws:
IndexOutOfBoundsException
- If index is negative or not smaller than the buffer's limit, minus three.
public long getLong()
Relative get method for reading a long value.
- Throws:
BufferUnderflowException
- If there are fewer than eight bytes remaining in this buffer.
public long getLong(int index)
Absolute get method for reading a long value.
- Throws:
IndexOutOfBoundsException
- If index is negative or not smaller than the buffer's limit, minus seven.
public short getShort()
Relative get method for reading a short value.
- Throws:
BufferUnderflowException
- If index is negative or not smaller than the buffer's limit, minus one.
public short getShort(int index)
Absolute get method for reading a short value.
- Throws:
IndexOutOfBoundsException
- If there are fewer than two bytes remaining in this buffer
public final boolean hasArray()
Tells whether ot not this buffer is backed by an accessiblebyte
array.
public int hashCode()
Calculates a hash code for this buffer. This is done withint
arithmetic, where ** represents exponentiation, by this formula:
s[position()] + 31 + (s[position()+1] + 30)*31**1 + ... + (s[limit()-1]+30)*31**(limit()-1)
. Where s is the buffer data. Note that the hashcode is dependent on buffer content, and therefore is not useful if the buffer content may change.
- Overrides:
- hashCode in interface Object
- Returns:
- the hash code
public ByteBuffer put(byte b)
Writes thebyte
at this buffer's current position, and then increments the position.
- Throws:
BufferOverflowException
- If there no remainingbyte
s in this buffer.ReadOnlyBufferException
- If this buffer is read-only.
public final ByteBuffer put(byte[] src)
Writes the content of the thebyte array
src into the buffer.
- Parameters:
src
- The array to copy into the buffer.
- Throws:
BufferOverflowException
- If there is insufficient space in this buffer for the remainingbyte
s in the source array.ReadOnlyBufferException
- If this buffer is read-only.
public ByteBuffer put(byte[] src, int offset, int length)
Writes the content of the thebyte array
src into the buffer. Before the transfer, it checks if there is fewer than length space remaining in this buffer.
- Parameters:
src
- The array to copy into the buffer.offset
- The offset within the array of the first byte to be read; must be non-negative and no larger than src.length.length
- The number of bytes to be read from the given array; must be non-negative and no larger than src.length - offset.
- Throws:
BufferOverflowException
- If there is insufficient space in this buffer for the remainingbyte
s in the source array.IndexOutOfBoundsException
- If the preconditions on the offset and length parameters do not holdReadOnlyBufferException
- If this buffer is read-only.
public ByteBuffer put(int index, byte b)
Absolute put method.
- Throws:
IndexOutOfBoundsException
- If index is negative or not smaller than the buffer's limit.ReadOnlyBufferException
- If this buffer is read-only.
public ByteBuffer put(ByteBuffer src)
Writes the content of the theByteBUFFER
src into the buffer. Before the transfer, it checks if there is fewer thansrc.remaining()
space remaining in this buffer.
- Parameters:
src
- The source data.
- Throws:
BufferOverflowException
- If there is insufficient space in this buffer for the remainingbyte
s in the source buffer.IllegalArgumentException
- If the source buffer is this buffer.ReadOnlyBufferException
- If this buffer is read-only.
public ByteBuffer putChar(char value)
Relative put method for writing a character value.
- Throws:
BufferOverflowException
- If this buffer's current position is not smaller than its limit.
public ByteBuffer putChar(int index, char value)
Absolute put method for writing a character value.
- Throws:
IndexOutOfBoundsException
- If index is negative or not smaller than the buffer's limit, minus one.
public ByteBuffer putDouble(double value)
Relative put method for writing a double value.
- Throws:
BufferOverflowException
- If this buffer's current position is not smaller than its limit.
public ByteBuffer putDouble(int index, double value)
Absolute put method for writing a double value.
- Throws:
IndexOutOfBoundsException
- If index is negative or not smaller than the buffer's limit, minus seven.
public ByteBuffer putFloat(float value)
Relative put method for writing a float value.
- Throws:
BufferOverflowException
- If there are fewer than four bytes remaining in this buffer.
public ByteBuffer putFloat(int index, float value)
Relative put method for writing a float value.
- Throws:
IndexOutOfBoundsException
- If index is negative or not smaller than the buffer's limit, minus three.
public ByteBuffer putInt(int value)
Relative put method for writing an integer value.
- Throws:
BufferOverflowException
- If this buffer's current position is not smaller than its limit.
public ByteBuffer putInt(int index, int value)
Absolute put method for writing an integer value.
- Throws:
IndexOutOfBoundsException
- If index is negative or not smaller than the buffer's limit, minus three.
public ByteBuffer putLong(int index, long value)
Absolute put method for writing a float value.
- Throws:
IndexOutOfBoundsException
- If index is negative or not smaller than the buffer's limit, minus seven.
public ByteBuffer putLong(long value)
Relative put method for writing a long value.
- Throws:
BufferOverflowException
- If this buffer's current position is not smaller than its limit.
public ByteBuffer putShort(int index, short value)
Absolute put method for writing a short value.
- Throws:
IndexOutOfBoundsException
- If index is negative or not smaller than the buffer's limit, minus one.
public ByteBuffer putShort(short value)
Relative put method for writing a short value.
- Throws:
BufferOverflowException
- If this buffer's current position is not smaller than its limit.
public ByteBuffer slice()
Creates a newByteBuffer
whose content is a shared subsequence of this buffer's content.
public String toString()
Returns a string summarizing the state of this buffer.
- Overrides:
- toString in interface Object
public static final ByteBuffer wrap(byte[] array, int offset, int length)
Wraps abyte
array into aByteBuffer
object.
- Throws:
IndexOutOfBoundsException
- If the preconditions on the offset and length parameters do not hold
GNU Classpath (0.19) |