Java java.nio ByteBuffer fields, constructors, methods, implement or subclass

Example usage for Java java.nio ByteBuffer fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for java.nio ByteBuffer.

The text is from its open source code.

Field

Endiannessorder
The byte order of this buffer, default is BIG_ENDIAN .

Method

ByteBufferallocate(int capacity)
Creates a byte buffer based on a newly allocated byte array.
ByteBufferallocateDirect(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.
intarrayOffset()
Returns the offset of the byte array which this buffer is based on, if there is one.
CharBufferasCharBuffer()
Returns a char buffer which is based on the remaining content of this byte buffer.
DoubleBufferasDoubleBuffer()
Returns a double buffer which is based on the remaining content of this byte buffer.
FloatBufferasFloatBuffer()
Returns a float buffer which is based on the remaining content of this byte buffer.
IntBufferasIntBuffer()
Returns a int buffer which is based on the remaining content of this byte buffer.
LongBufferasLongBuffer()
Returns a long buffer which is based on the remaining content of this byte buffer.
ByteBufferasReadOnlyBuffer()
Returns a read-only buffer that shares its content with this buffer.
ShortBufferasShortBuffer()
Returns a short buffer which is based on the remaining content of this byte buffer.
intcapacity()
Returns the capacity of this buffer.
Bufferclear()
Clears this buffer.
ByteBuffercompact()
Compacts this byte buffer.
intcompareTo(ByteBuffer otherBuffer)
Compares the remaining bytes of this buffer to another byte buffer's remaining bytes.
ByteBufferduplicate()
Returns a duplicated buffer that shares its content with this buffer.
booleanequals(Object other)
Checks whether this byte buffer is equal to another object.
Bufferflip()
Flips this buffer.
ByteBufferget(byte[] dest)
Reads bytes from the current position into the specified byte array and increases the position by the number of bytes read.
byteget(int index)
Returns the byte at the specified index and does not change the position.
byteget()
Returns the byte at the current position and increases the position by 1.
ByteBufferget(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.
chargetChar(int index)
Returns the char at the specified index.
chargetChar()
Returns the char at the current position and increases the position by 2.
ClassgetClass()
Returns the runtime class of this Object .
doublegetDouble()
Returns the double at the current position and increases the position by 8.
doublegetDouble(int index)
Returns the double at the specified index.
floatgetFloat(int index)
Returns the float at the specified index.
floatgetFloat()
Returns the float at the current position and increases the position by 4.
intgetInt(int index)
Returns the int at the specified index.
intgetInt()
Returns the int at the current position and increases the position by 4.
longgetLong()
Returns the long at the current position and increases the position by 8.
longgetLong(int index)
Returns the long at the specified index.
shortgetShort(int index)
Returns the short at the specified index.
shortgetShort()
Returns the short at the current position and increases the position by 2.
booleanhasArray()
Indicates whether this buffer is based on a byte array and provides read/write access.
inthashCode()
Calculates this buffer's hash code from the remaining chars.
booleanhasRemaining()
Indicates if there are elements remaining in this buffer, that is if position < limit .
booleanisDirect()
Indicates whether this buffer is direct.
booleanisReadOnly()
Indicates whether this buffer is read-only.
Bufferlimit(int newLimit)
Sets the limit of this buffer.
intlimit()
Returns the limit of this buffer.
Buffermark()
Marks the current position, so that the position may return to this point later by calling reset().
Bufferposition(int newPosition)
Sets the position of this buffer.
intposition()
Returns the position of this buffer.
ByteBufferput(byte b)
Writes the given byte to the current position and increases the position by 1.
ByteBufferput(byte[] src)
Writes bytes in the given byte array to the current position and increases the position by the number of bytes written.
ByteBufferput(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.
ByteBufferput(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.
ByteBufferput(int index, byte b)
Write a byte to the specified index of this buffer without changing the position.
ByteBufferputChar(char value)
Writes the given char to the current position and increases the position by 2.
ByteBufferputChar(int index, char value)
Writes the given char to the specified index of this buffer.
ByteBufferputDouble(double value)
Writes the given double to the current position and increases the position by 8.
ByteBufferputDouble(int index, double value)
Writes the given double to the specified index of this buffer.
ByteBufferputFloat(float value)
Writes the given float to the current position and increases the position by 4.
ByteBufferputFloat(int index, float value)
Writes the given float to the specified index of this buffer.
ByteBufferputInt(int value)
Writes the given int to the current position and increases the position by 4.
ByteBufferputInt(int index, int value)
Writes the given int to the specified index of this buffer.
ByteBufferputLong(long value)
Writes the given long to the current position and increases the position by 8.
ByteBufferputLong(int index, long value)
Writes the given long to the specified index of this buffer.
ByteBufferputShort(int index, short value)
Writes the given short to the specified index of this buffer.
ByteBufferputShort(short value)
Writes the given short to the current position and increases the position by 2.
intremaining()
Returns the number of remaining elements in this buffer, that is limit - position .
Bufferreset()
Resets the position of this buffer to the mark.
Bufferrewind()
Rewinds this buffer.
ByteBufferslice()
Returns a sliced buffer that shares its content with this buffer.
StringtoString()
Returns a string representing the state of this byte buffer.
ByteBufferwrap(byte[] array)
Creates a new byte buffer by wrapping the given byte array.
ByteBufferwrap(byte[] array, int start, int len)
Creates a new byte buffer by wrapping the given byte array.