ByteBuffer (Java SE 22 & JDK 22)
-
Method Summary
alignedSlice(int unitSize) Creates a new byte buffer whose content is a shared and aligned subsequence of this buffer's content.
final intalignmentOffset(int index, int unitSize) Returns the memory address, pointing to the byte at the given index, modulo the given unit size.
allocate(int capacity) Allocates a new byte buffer.
allocateDirect(int capacity) Allocates a new direct byte buffer.
final byte[]array()Returns the byte array that backs this buffer (optional operation).
final intReturns the offset within this buffer's backing array of the first element of the buffer (optional operation).
Creates a view of this byte buffer as a char buffer.
Creates a view of this byte buffer as a double buffer.
Creates a view of this byte buffer as a float buffer.
Creates a view of this byte buffer as an int buffer.
Creates a view of this byte buffer as a long buffer.
Creates a new, read-only byte buffer that shares this buffer's content.
Creates a view of this byte buffer as a short buffer.
clear()compact()Compacts this buffer (optional operation).
intCompares this buffer to another.
Creates a new byte buffer that shares this buffer's content.
booleanTells whether or not this buffer is equal to another object.
flip()abstract byteget()get(byte[] dst) Relative bulk get method.
get(byte[] dst, int offset, int length) Relative bulk get method.
abstract byteget(int index) get(int index, byte[] dst) Absolute bulk get method.
get(int index, byte[] dst, int offset, int length) Absolute bulk get method.
abstract chargetChar()Relative get method for reading a char value.
abstract chargetChar(int index) Absolute get method for reading a char value.
abstract doubleRelative get method for reading a double value.
abstract doublegetDouble(int index) Absolute get method for reading a double value.
abstract floatgetFloat()Relative get method for reading a float value.
abstract floatgetFloat(int index) Absolute get method for reading a float value.
abstract intgetInt()Relative get method for reading an int value.
abstract intgetInt(int index) Absolute get method for reading an int value.
abstract longgetLong()Relative get method for reading a long value.
abstract longgetLong(int index) Absolute get method for reading a long value.
abstract shortgetShort()Relative get method for reading a short value.
abstract shortgetShort(int index) Absolute get method for reading a short value.
final booleanhasArray()Tells whether or not this buffer is backed by an accessible byte array.
inthashCode()Returns the current hash code of this buffer.
abstract booleanisDirect()Tells whether or not this byte buffer is direct.
limit(int newLimit) Sets this buffer's limit.
mark()Sets this buffer's mark at its position.
intFinds and returns the relative index of the first mismatch between this buffer and a given buffer.
order()Retrieves this buffer's byte order.
Modifies this buffer's byte order.
position(int newPosition) Sets this buffer's position.
put(byte b) Relative put method (optional operation).
put(byte[] src) Relative bulk put method (optional operation).
put(byte[] src, int offset, int length) Relative bulk put method (optional operation).
put(int index, byte b) Absolute put method (optional operation).
put(int index, byte[] src) Absolute bulk put method (optional operation).
put(int index, byte[] src, int offset, int length) Absolute bulk put method (optional operation).
put(int index, ByteBuffer src, int offset, int length) Absolute bulk put method (optional operation).
Relative bulk put method (optional operation).
putChar(char value) Relative put method for writing a char value (optional operation).
putChar(int index, char value) Absolute put method for writing a char value (optional operation).
putDouble(double value) Relative put method for writing a double value (optional operation).
putDouble(int index, double value) Absolute put method for writing a double value (optional operation).
putFloat(float value) Relative put method for writing a float value (optional operation).
putFloat(int index, float value) Absolute put method for writing a float value (optional operation).
putInt(int value) Relative put method for writing an int value (optional operation).
putInt(int index, int value) Absolute put method for writing an int value (optional operation).
putLong(int index, long value) Absolute put method for writing a long value (optional operation).
putLong(long value) Relative put method for writing a long value (optional operation).
putShort(int index, short value) Absolute put method for writing a short value (optional operation).
putShort(short value) Relative put method for writing a short value (optional operation).
reset()Resets this buffer's position to the previously-marked position.
rewind()slice()Creates a new byte buffer whose content is a shared subsequence of this buffer's content.
slice(int index, int length) Creates a new byte buffer whose content is a shared subsequence of this buffer's content.
toString()Returns a string summarizing the state of this buffer.
wrap(byte[] array) Wraps a byte array into a buffer.
wrap(byte[] array, int offset, int length) Wraps a byte array into a buffer.
-
Method Details
-
allocateDirect
-
allocate
-
wrap
-
wrap
-
slice
-
slice
-
duplicate
-
asReadOnlyBuffer
-
get
-
put
-
get
-
put
-
get
-
get
-
get
-
get
-
put
-
put
-
put
-
put
-
put
-
put
-
hasArray
-
array
-
arrayOffset
-
position
-
limit
-
mark
-
reset
-
clear
-
flip
-
rewind
-
compact
-
isDirect
-
toString
-
hashCode
-
equals
-
compareTo
-
mismatch
-
order
-
order
-
alignmentOffset
-
alignedSlice
-
getChar
-
putChar
-
getChar
-
putChar
-
asCharBuffer
-
getShort
-
putShort
-
getShort
-
putShort
-
asShortBuffer
-
getInt
-
putInt
-
getInt
-
putInt
-
asIntBuffer
-
getLong
-
putLong
-
getLong
-
putLong
-
asLongBuffer
-
getFloat
-
putFloat
-
getFloat
-
putFloat
-
asFloatBuffer
-
getDouble
-
putDouble
-
getDouble
-
putDouble
-
asDoubleBuffer
-