java.nio
Class ByteBuffer
java.lang.Object
|
+--java.nio.Buffer
|
+--java.nio.ByteBuffer
All Implemented Interfaces:
Comparable
Since:static java.nio.ByteBuffer | allocate(int capacity)
|
static java.nio.ByteBuffer | allocateDirect(int capacity)
|
byte[] | array()
|
int | arrayOffset()
|
java.nio.CharBuffer | asCharBuffer()
|
java.nio.DoubleBuffer | asDoubleBuffer()
|
java.nio.FloatBuffer | asFloatBuffer()
|
java.nio.IntBuffer | asIntBuffer()
|
java.nio.LongBuffer | asLongBuffer()
|
java.nio.ByteBuffer | asReadOnlyBuffer()
|
java.nio.ShortBuffer | asShortBuffer()
|
java.nio.ByteBuffer | compact()
|
int | compareTo(java.lang.Object obj)
|
java.nio.ByteBuffer | duplicate()
|
boolean | equals(java.lang.Object obj)
|
java.nio.ByteBuffer | get(byte[] dst, int offset, int length)
|
java.nio.ByteBuffer | get(byte[] dst)
|
byte | get()
|
byte | get(int index)
|
char | getChar()
|
char | getChar(int index)
|
double | getDouble()
|
double | getDouble(int index)
|
float | getFloat()
|
float | getFloat(int index)
|
int | getInt()
|
int | getInt(int index)
|
long | getLong()
|
long | getLong(int index)
|
short | getShort()
|
short | getShort(int index)
|
boolean | hasArray()
|
int | hashCode()
|
boolean | isDirect()
|
java.nio.ByteOrder | order()
|
java.nio.ByteBuffer | order(java.nio.ByteOrder endian)
|
java.nio.ByteBuffer | put(java.nio.ByteBuffer src)
|
java.nio.ByteBuffer | put(byte[] src, int offset, int length)
|
java.nio.ByteBuffer | put(byte[] src)
|
java.nio.ByteBuffer | put(byte b)
|
java.nio.ByteBuffer | put(int index, byte b)
|
java.nio.ByteBuffer | putChar(char value)
|
java.nio.ByteBuffer | putChar(int index, char value)
|
java.nio.ByteBuffer | putDouble(double value)
|
java.nio.ByteBuffer | putDouble(int index, double value)
|
java.nio.ByteBuffer | putFloat(float value)
|
java.nio.ByteBuffer | putFloat(int index, float value)
|
java.nio.ByteBuffer | putInt(int value)
|
java.nio.ByteBuffer | putInt(int index, int value)
|
java.nio.ByteBuffer | putLong(long value)
|
java.nio.ByteBuffer | putLong(int index, long value)
|
java.nio.ByteBuffer | putShort(short value)
|
java.nio.ByteBuffer | putShort(int index, short value)
|
java.nio.ByteBuffer | slice()
|
java.lang.String | toString()
|
static java.nio.ByteBuffer | wrap(byte[] array, int offset, int length)
|
static java.nio.ByteBuffer | wrap(byte[] array)
|
backing_buffer
protected byte[] backing_buffer
allocate
public static ByteBuffer allocate(int capacity)
Allocates a new byte buffer.
Parameters:
allocateDirect
public static ByteBuffer allocateDirect(int capacity)
Allocates a new direct byte buffer.
Parameters:
array
public final byte[] array()
Returns the byte array that backs this buffer.
Throws:
arrayOffset
public final int arrayOffset()
Returns the offset within this buffer's backing array of the first element
of the buffer
Throws:
asCharBuffer
public CharBuffer asCharBuffer()
Creates a view of this byte buffer as a char buffer.
asDoubleBuffer
public DoubleBuffer asDoubleBuffer()
Creates a view of this byte buffer as a double buffer.
asFloatBuffer
public FloatBuffer asFloatBuffer()
Creates a view of this byte buffer as a float buffer.
asIntBuffer
public IntBuffer asIntBuffer()
Creates a view of this byte buffer as an integer buffer.
asLongBuffer
public LongBuffer asLongBuffer()
Creates a view of this byte buffer as a long buffer.
asReadOnlyBuffer
public ByteBuffer asReadOnlyBuffer()
Creates a new, read-only byte buffer that shares this buffer's content.
asShortBuffer
public ShortBuffer asShortBuffer()
Creates a view of this byte buffer as a short buffer.
compact
public ByteBuffer compact()
Compacts this buffer.
Throws:
compareTo
public int compareTo(java.lang.Object obj)
Compares this buffer to another object.
Parameters:
Throws:
duplicate
public ByteBuffer duplicate()
Creates a new byte 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 byte get()
Reads the byte at this buffer's current position,
and then increments the position.
Throws:
get
public ByteBuffer get(byte[] dst)
This method transfers bytes from this buffer into the given
destination array.
Parameters:
Throws:
get
public ByteBuffer get(byte[] dst, int offset, int length)
This method transfers bytes from this buffer into
the given destination array.
Parameters:
Throws:
get
public byte get(int index)
Absolute get method.
Parameters:
Throws:
getChar
public char getChar()
Relative get method for reading a character value.
Throws:
getChar
public char getChar(int index)
Absolute get method for reading a character value.
Parameters:
Throws:
getDouble
public double getDouble()
Relative get method for reading a double value.
Throws:
getDouble
public double getDouble(int index)
Absolute get method for reading a double value.
Parameters:
Throws:
getFloat
public float getFloat()
Relative get method for reading a float value.
Throws:
getFloat
public float getFloat(int index)
Absolute get method for reading a float value.
Parameters:
Throws:
getInt
public int getInt()
Relative get method for reading an integer value.
Throws:
getInt
public int getInt(int index)
Absolute get method for reading an integer value.
Parameters:
Throws:
getLong
public long getLong()
Relative get method for reading a long value.
Throws:
getLong
public long getLong(int index)
Absolute get method for reading a long value.
Parameters:
Throws:
getShort
public short getShort()
Relative get method for reading a short value.
Throws:
getShort
public short getShort(int index)
Absolute get method for reading a short value.
Parameters:
Throws:
hasArray
public final boolean hasArray()
Tells whether or not this buffer is backed by an accessible byte array.
hashCode
public int hashCode()
Returns the current hash code of this buffer.
isDirect
public boolean isDirect()
Tells whether or not this buffer is direct.
order
public final ByteOrder order()
Retrieves this buffer's byte order.
order
public final ByteBuffer order(java.nio.ByteOrder endian)
Modifies this buffer's byte order.
Parameters:
put
public final ByteBuffer put(byte[] src)
Writes the content of the the array src into the buffer.
Parameters:
Throws:
put
public ByteBuffer put(byte b)
Relative put method.
Parameters:
Throws:
put
public ByteBuffer put(byte[] src, int offset, int length)
Writes the content of the the array src into the buffer.
Parameters:
Throws:
put
public ByteBuffer put(int index, byte b)
Absolute put method.
Parameters:
Throws:
put
public ByteBuffer put(java.nio.ByteBuffer src)
Writes the content of src into the buffer.
Parameters:
Throws:
putChar
public ByteBuffer putChar(char value)
Relative put method for writing a character value.
Parameters:
Throws:
putChar
public ByteBuffer putChar(int index, char value)
Absolute put method for writing a character value.
Parameters:
Throws:
putDouble
public ByteBuffer putDouble(double value)
Relative put method for writing a double value.
Parameters:
Throws:
putDouble
public ByteBuffer putDouble(int index, double value)
Absolute put method for writing a double value.
Parameters:
Throws:
putFloat
public ByteBuffer putFloat(float value)
Relative put method for writing a float value.
Parameters:
Throws:
putFloat
public ByteBuffer putFloat(int index, float value)
Relative put method for writing a float value.
Parameters:
Throws:
putInt
public ByteBuffer putInt(int value)
Relative put method for writing an integer value.
Parameters:
Throws:
putInt
public ByteBuffer putInt(int index, int value)
Absolute put method for writing an integer value.
Parameters:
Throws:
putLong
public ByteBuffer putLong(int index, long value)
Absolute put method for writing a float value.
Parameters:
Throws:
putLong
public ByteBuffer putLong(long value)
Relative put method for writing a long value.
Parameters:
Throws:
putShort
public ByteBuffer putShort(int index, short value)
Absolute put method for writing a short value.
Parameters:
Throws:
putShort
public ByteBuffer putShort(short value)
Relative put method for writing a short value.
Parameters:
Throws:
slice
public ByteBuffer slice()
Creates a new byte buffer whose content is a shared subsequence of this
buffer's content.
toString
public String toString()
Returns a string summarizing the state of this buffer.
wrap
public static final ByteBuffer wrap(byte[] array)
Wraps a byte array into a buffer.
Parameters:
wrap
public static final ByteBuffer wrap(byte[] array, int offset, int length)
Wraps a byte array into a buffer.
Parameters:
Throws: