Example usage for Java java.nio ByteBuffer fields, constructors, methods, implement or subclass
The text is from its open source code.
Endianness | order The byte order of this buffer, default is BIG_ENDIAN . |
ByteBuffer | allocate(int capacity) Creates a byte buffer based on a newly allocated byte array. |
ByteBuffer | allocateDirect(int capacity) Creates a direct byte buffer based on a newly allocated memory block. |
byte[] | array() Returns the byte array which this buffer is based on, if there is one. |
int | arrayOffset() Returns the offset of the byte array which this buffer is based on, if there is one. |
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. |
ByteBuffer | asReadOnlyBuffer() Returns a read-only buffer that shares its content with this buffer. |
ShortBuffer | asShortBuffer() Returns a short buffer which is based on the remaining content of this byte buffer. |
int | capacity() Returns the capacity of this buffer. |
Buffer | clear() Clears this buffer. |
ByteBuffer | compact() Compacts this byte buffer. |
int | compareTo(ByteBuffer otherBuffer) Compares the remaining bytes of this buffer to another byte buffer's remaining bytes. |
ByteBuffer | duplicate() Returns a duplicated buffer that shares its content with this buffer. |
boolean | equals(Object other) Checks whether this byte buffer is equal to another object. |
Buffer | flip() Flips this buffer. |
ByteBuffer | get(byte[] dest) Reads bytes from the current position into the specified byte array and increases the position by the number of bytes read. |
byte | get(int index) Returns the byte at the specified index and does not change the position. |
byte | get() Returns the byte at the current position and increases the position by 1. |
ByteBuffer | get(byte[] dest, int off, int len) Reads bytes from the current position into the specified byte array, starting at the specified offset, and increases the position by the number of bytes read. |
char | getChar(int index) Returns the char at the specified index. |
char | getChar() Returns the char at the current position and increases the position by 2. |
Class> | getClass() Returns the runtime class of this Object . |
double | getDouble() Returns the double at the current position and increases the position by 8. |
double | getDouble(int index) Returns the double at the specified index. |
float | getFloat(int index) Returns the float at the specified index. |
float | getFloat() Returns the float at the current position and increases the position by 4. |
int | getInt(int index) Returns the int at the specified index. |
int | getInt() Returns the int at the current position and increases the position by 4. |
long | getLong() Returns the long at the current position and increases the position by 8. |
long | getLong(int index) Returns the long at the specified index. |
short | getShort(int index) Returns the short at the specified index. |
short | getShort() Returns the short at the current position and increases the position by 2. |
boolean | hasArray() Indicates whether this buffer is based on a byte array and provides read/write access. |
int | hashCode() Calculates this buffer's hash code from the remaining chars. |
boolean | hasRemaining() Indicates if there are elements remaining in this buffer, that is if position < limit . |
boolean | isDirect() Indicates whether this buffer is direct. |
boolean | isReadOnly() Indicates whether this buffer is read-only. |
Buffer | limit(int newLimit) Sets the limit of this buffer. |
int | limit() Returns the limit of this buffer. |
Buffer | mark() Marks the current position, so that the position may return to this point later by calling reset() . |
Buffer | position(int newPosition) Sets the position of this buffer. |
int | position() Returns the position of this buffer. |
ByteBuffer | put(byte b) Writes the given byte to the current position and increases the position by 1. |
ByteBuffer | put(byte[] src) Writes bytes in the given byte array to the current position and increases the position by the number of bytes written. |
ByteBuffer | put(ByteBuffer src) Writes all the remaining bytes of the src byte buffer to this buffer's current position, and increases both buffers' position by the number of bytes copied. |
ByteBuffer | put(byte[] src, int off, int len) Writes bytes in the given byte array, starting from the specified offset, to the current position and increases the position by the number of bytes written. |
ByteBuffer | put(int index, byte b) Write a byte to the specified index of this buffer without changing the position. |
ByteBuffer | putChar(char value) Writes the given char to the current position and increases the position by 2. |
ByteBuffer | putChar(int index, char value) Writes the given char to the specified index of this buffer. |
ByteBuffer | putDouble(double value) Writes the given double to the current position and increases the position by 8. |
ByteBuffer | putDouble(int index, double value) Writes the given double to the specified index of this buffer. |
ByteBuffer | putFloat(float value) Writes the given float to the current position and increases the position by 4. |
ByteBuffer | putFloat(int index, float value) Writes the given float to the specified index of this buffer. |
ByteBuffer | putInt(int value) Writes the given int to the current position and increases the position by 4. |
ByteBuffer | putInt(int index, int value) Writes the given int to the specified index of this buffer. |
ByteBuffer | putLong(long value) Writes the given long to the current position and increases the position by 8. |
ByteBuffer | putLong(int index, long value) Writes the given long to the specified index of this buffer. |
ByteBuffer | putShort(int index, short value) Writes the given short to the specified index of this buffer. |
ByteBuffer | putShort(short value) Writes the given short to the current position and increases the position by 2. |
int | remaining() Returns the number of remaining elements in this buffer, that is limit - position . |
Buffer | reset() Resets the position of this buffer to the mark . |
Buffer | rewind() Rewinds this buffer. |
ByteBuffer | slice() Returns a sliced buffer that shares its content with this buffer. |
String | toString() Returns a string representing the state of this byte buffer. |
ByteBuffer | wrap(byte[] array) Creates a new byte buffer by wrapping the given byte array. |
ByteBuffer | wrap(byte[] array, int start, int len) Creates a new byte buffer by wrapping the given byte array. |