public abstract class DirectByteBuffer extends ByteBuffer implements HasArrayBufferView
DirectByteBuffer implements all the shared readonly methods and is extended by the other two classes.
All methods are marked final for runtime performance.
| Modifier and Type | Method and Description |
|---|---|
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.
|
ShortBuffer |
asShortBuffer()
Returns a short buffer which is based on the remaining content of this
byte buffer.
|
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.
|
byte |
get(int index)
Returns the byte at the specified index and does not change the position.
|
char |
getChar()
Returns the char at the current position and increases the position by 2.
|
char |
getChar(int index)
Returns the char at the specified index.
|
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.
|
int |
getElementSize()
Returns the element size in bytes (e.g.
|
int |
getElementType()
Returns the open GL element type constant corresponding to the buffer contents.
|
float |
getFloat()
Returns the float at the current position and increases the position by
4.
|
float |
getFloat(int index)
Returns the float at the specified index.
|
int |
getInt()
Returns the int at the current position and increases the position by 4.
|
int |
getInt(int index)
Returns the int at the specified index.
|
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()
Returns the short at the current position and increases the position by 2.
|
short |
getShort(int index)
Returns the short at the specified index.
|
elemental2.core.ArrayBufferView |
getTypedArray() |
boolean |
isDirect()
Indicates whether this buffer is direct.
|
protected int |
loadInt(int baseOffset) |
protected long |
loadLong(int baseOffset) |
protected short |
loadShort(int baseOffset) |
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.
|
protected void |
store(int baseOffset,
int value) |
protected void |
store(int baseOffset,
long value) |
protected void |
store(int baseOffset,
short value) |
allocate, allocateDirect, array, arrayOffset, asReadOnlyBuffer, compact, compareTo, duplicate, equals, get, hasArray, hashCode, order, order, put, put, put, put, put, putDouble, putDouble, putFloat, putFloat, putInt, putInt, putLong, putLong, putShort, putShort, slice, stringToByteBuffer, toString, wrap, wrappublic elemental2.core.ArrayBufferView getTypedArray()
getTypedArray in interface HasArrayBufferViewpublic int getElementSize()
HasArrayBufferViewgetElementSize in interface HasArrayBufferViewpublic final ByteBuffer get(byte[] dest, int off, int len)
ByteBufferget in class ByteBufferdest - the target byte array.off - the offset of the byte array, must not be negative and
not greater than dest.length.len - the number of bytes to read, must not be negative and not
greater than dest.length - offpublic final byte get()
ByteBufferget in class ByteBufferpublic final byte get(int index)
ByteBufferget in class ByteBufferindex - the index, must not be negative and less than limit.public final double getDouble()
ByteBufferThe 8 bytes starting from the current position are composed into a double according to the current byte order and returned.
getDouble in class ByteBufferpublic final double getDouble(int index)
ByteBufferThe 8 bytes starting at the specified index are composed into a double according to the current byte order and returned. The position is not changed.
getDouble in class ByteBufferindex - the index, must not be negative and equal or less than
limit - 8.public final float getFloat()
ByteBufferThe 4 bytes starting at the current position are composed into a float according to the current byte order and returned.
getFloat in class ByteBufferpublic final float getFloat(int index)
ByteBufferThe 4 bytes starting at the specified index are composed into a float according to the current byte order and returned. The position is not changed.
getFloat in class ByteBufferindex - the index, must not be negative and equal or less than
limit - 4.public final int getInt()
ByteBufferThe 4 bytes starting at the current position are composed into a int according to the current byte order and returned.
getInt in class ByteBufferpublic final int getInt(int index)
ByteBufferThe 4 bytes starting at the specified index are composed into a int according to the current byte order and returned. The position is not changed.
getInt in class ByteBufferindex - the index, must not be negative and equal or less than
limit - 4.public final long getLong()
ByteBufferThe 8 bytes starting at the current position are composed into a long according to the current byte order and returned.
getLong in class ByteBufferpublic final long getLong(int index)
ByteBufferThe 8 bytes starting at the specified index are composed into a long according to the current byte order and returned. The position is not changed.
getLong in class ByteBufferindex - the index, must not be negative and equal or less than
limit - 8.public final short getShort()
ByteBufferThe 2 bytes starting at the current position are composed into a short according to the current byte order and returned.
getShort in class ByteBufferpublic final short getShort(int index)
ByteBufferThe 2 bytes starting at the specified index are composed into a short according to the current byte order and returned. The position is not changed.
getShort in class ByteBufferindex - the index, must not be negative and equal or less than
limit - 2.public final boolean isDirect()
ByteBufferisDirect in class ByteBuffertrue if this buffer is direct, false otherwise.protected final int loadInt(int baseOffset)
protected final long loadLong(int baseOffset)
protected final short loadShort(int baseOffset)
protected final void store(int baseOffset,
int value)
protected final void store(int baseOffset,
long value)
protected final void store(int baseOffset,
short value)
public int getElementType()
HasArrayBufferViewgetElementType in interface HasArrayBufferViewpublic CharBuffer asCharBuffer()
ByteBufferThe new buffer's position is zero, its limit and capacity is the number of remaining bytes divided by two, and its mark is not set. The new buffer's read-only property and byte order are the same as this buffer's. The new buffer is direct if this byte buffer is direct.
The new buffer shares its content with this buffer, which means either buffer's change of content will be visible to the other. The two buffer's position, limit and mark are independent.
asCharBuffer in class ByteBufferpublic DoubleBuffer asDoubleBuffer()
ByteBufferThe new buffer's position is zero, its limit and capacity is the number of remaining bytes divided by eight, and its mark is not set. The new buffer's read-only property and byte order are the same as this buffer's. The new buffer is direct if this byte buffer is direct.
The new buffer shares its content with this buffer, which means either buffer's change of content will be visible to the other. The two buffer's position, limit and mark are independent.
asDoubleBuffer in class ByteBufferpublic FloatBuffer asFloatBuffer()
ByteBufferThe new buffer's position is zero, its limit and capacity is the number of remaining bytes divided by four, and its mark is not set. The new buffer's read-only property and byte order are the same as this buffer's. The new buffer is direct if this byte buffer is direct.
The new buffer shares its content with this buffer, which means either buffer's change of content will be visible to the other. The two buffer's position, limit and mark are independent.
asFloatBuffer in class ByteBufferpublic IntBuffer asIntBuffer()
ByteBufferThe new buffer's position is zero, its limit and capacity is the number of remaining bytes divided by four, and its mark is not set. The new buffer's read-only property and byte order are the same as this buffer's. The new buffer is direct if this byte buffer is direct.
The new buffer shares its content with this buffer, which means either buffer's change of content will be visible to the other. The two buffer's position, limit and mark are independent.
asIntBuffer in class ByteBufferpublic LongBuffer asLongBuffer()
ByteBufferThe new buffer's position is zero, its limit and capacity is the number of remaining bytes divided by eight, and its mark is not set. The new buffer's read-only property and byte order are the same as this buffer's. The new buffer is direct if this byte buffer is direct.
The new buffer shares its content with this buffer, which means either buffer's change of content will be visible to the other. The two buffer's position, limit and mark are independent.
asLongBuffer in class ByteBufferpublic ShortBuffer asShortBuffer()
ByteBufferThe new buffer's position is zero, its limit and capacity is the number of remaining bytes divided by two, and its mark is not set. The new buffer's read-only property and byte order are the same as this buffer's. The new buffer is direct if this byte buffer is direct.
The new buffer shares its content with this buffer, which means either buffer's change of content will be visible to the other. The two buffer's position, limit and mark are independent.
asShortBuffer in class ByteBufferpublic final char getChar()
ByteBufferThe 2 bytes starting at the current position are composed into a char according to the current byte order and returned.
getChar in class ByteBufferpublic final char getChar(int index)
ByteBufferThe 2 bytes starting from the specified index are composed into a char according to the current byte order and returned. The position is not changed.
getChar in class ByteBufferindex - the index, must not be negative and equal or less than
limit - 2.public final ByteBuffer putChar(char value)
ByteBufferThe char is converted to bytes using the current byte order.
putChar in class ByteBuffervalue - the char to write.public final ByteBuffer putChar(int index, char value)
ByteBufferThe char is converted to bytes using the current byte order. The position is not changed.
putChar in class ByteBufferindex - the index, must not be negative and equal or less than
limit - 2.value - the char to write.Copyright © 2020 Dmitrii Tikhomirov. All rights reserved.