ByteBuffer

abstract
class ByteBuffer : Buffer {}

Constructors

this
this(int mark, int pos, int lim, int cap, byte[] hb, int offset)
Undocumented in source.
this
this(int mark, int pos, int lim, int cap)
Undocumented in source.

Members

Aliases

getRemaining
deprecated alias getRemaining = peekRemaining
Undocumented in source.

Functions

array
byte[] array()

Returns the byte array that backs this buffer&nbsp;&nbsp;<i>(optional operation)</i>.

arrayOffset
int arrayOffset()

Returns the offset within this buffer's backing array of the first element of the buffer&nbsp;&nbsp;<i>(optional operation)</i>.

asReadOnlyBuffer
ByteBuffer asReadOnlyBuffer()

Creates a new, read-only byte buffer that shares this buffer's content.

byteOffset
size_t byteOffset(size_t i)
Undocumented in source. Be warned that the author may not have intended to support it.
compact
ByteBuffer compact()

Compacts this buffer&nbsp;&nbsp;<i>(optional operation)</i>.

duplicate
ByteBuffer duplicate()

Creates a new byte buffer that shares this buffer's content.

get
byte get()

Relative <i>get</i> method. Reads the byte at this buffer's current position, and then increments the position.

get
byte get(int index)

Absolute <i>get</i> method. Reads the byte at the given index.

get
ByteBuffer get(byte[] dst, int offset, int length)

Relative bulk <i>get</i> method.

get
ByteBuffer get(byte[] dst)

Relative bulk <i>get</i> method.

get
T get()

Relative <i>get</i> method for reading an int value.

get
T get(int index)

Absolute <i>get</i> method for reading an int value.

getInt
int getInt()

Relative <i>get</i> method for reading an int value.

getInt
int getInt(int index)

Absolute <i>get</i> method for reading an int value.

getLong
long getLong()

Relative <i>get</i> method for reading a long value.

getLong
long getLong(int index)

Absolute <i>get</i> method for reading a long value.

getShort
short getShort()

Relative <i>get</i> method for reading a short value.

getShort
short getShort(int index)

Absolute <i>get</i> method for reading a short value.

getString
deprecated string getString(size_t offset, size_t len)
Undocumented in source. Be warned that the author may not have intended to support it.
hasArray
bool hasArray()

Tells whether or not this buffer is backed by an accessible byte array.

ix
int ix(int i)
Undocumented in source. Be warned that the author may not have intended to support it.
order
ByteOrder order()

Retrieves this buffer's byte order.

order
ByteBuffer order(ByteOrder bo)

Modifies this buffer's byte order.

peek
byte[] peek(size_t offset, size_t len)
Undocumented in source. Be warned that the author may not have intended to support it.
peekRemaining
byte[] peekRemaining()
Undocumented in source. Be warned that the author may not have intended to support it.
put
ByteBuffer put(byte b)

Relative <i>put</i> method&nbsp;&nbsp;<i>(optional operation)</i>.

put
ByteBuffer put(int index, byte b)

Absolute <i>put</i> method&nbsp;&nbsp;<i>(optional operation)</i>.

put
ByteBuffer put(ByteBuffer src)

Relative bulk <i>put</i> method&nbsp;&nbsp;<i>(optional operation)</i>.

put
ByteBuffer put(byte[] src, int offset, int length)

Relative bulk <i>put</i> method&nbsp;&nbsp;<i>(optional operation)</i>.

put
ByteBuffer put(byte[] src)

Relative bulk <i>put</i> method&nbsp;&nbsp;<i>(optional operation)</i>.

put
ByteBuffer put(string src)
Undocumented in source. Be warned that the author may not have intended to support it.
put
ByteBuffer put(T value)

Relative <i>put</i> method for writing a short value&nbsp;&nbsp;<i>(optional operation)</i>.

put
ByteBuffer put(int index, T value)

Absolute <i>put</i> method for writing a short value&nbsp;&nbsp;<i>(optional operation)</i>.

putInt
ByteBuffer putInt(int value)

Relative <i>put</i> method for writing an int value&nbsp;&nbsp;<i>(optional operation)</i>.

putInt
ByteBuffer putInt(int index, int value)

Absolute <i>put</i> method for writing an int value&nbsp;&nbsp;<i>(optional operation)</i>.

putLong
ByteBuffer putLong(long value)

Relative <i>put</i> method for writing a long value&nbsp;&nbsp;<i>(optional operation)</i>.

putLong
ByteBuffer putLong(int index, long value)

Absolute <i>put</i> method for writing a long value&nbsp;&nbsp;<i>(optional operation)</i>.

putShort
ByteBuffer putShort(short value)

Relative <i>put</i> method for writing a short value&nbsp;&nbsp;<i>(optional operation)</i>.

putShort
ByteBuffer putShort(int index, short value)

Absolute <i>put</i> method for writing a short value&nbsp;&nbsp;<i>(optional operation)</i>.

slice
ByteBuffer slice()

Creates a new byte buffer whose content is a shared subsequence of this buffer's content.

toString
string toString()

Returns a string summarizing the state of this buffer.

Static functions

allocate
deprecated ByteBuffer allocate(size_t capacity)

Allocates a new byte buffer.

allocateDirect
deprecated ByteBuffer allocateDirect(int capacity)

Allocates a new direct byte buffer.

wrap
deprecated ByteBuffer wrap(byte[] array, int offset, int length)

Wraps a byte array into a buffer.

wrap
deprecated ByteBuffer wrap(byte[] array)

Wraps a byte array into a buffer.

Variables

bigEndian
bool bigEndian;
Undocumented in source.
hb
byte[] hb;
Undocumented in source.
offset
int offset;
Undocumented in source.

Inherited Members

From Buffer

capacity
int capacity()

Returns this buffer's capacity.

position
int position()

Returns this buffer's position.

position
Buffer position(int newPosition)

Sets this buffer's position. If the mark is defined and larger than the new position then it is discarded.

limit
int limit()

Returns this buffer's limit.

limit
Buffer limit(int newLimit)

Sets this buffer's limit. If the position is larger than the new limit then it is set to the new limit. If the mark is defined and larger than the new limit then it is discarded.

mark
Buffer mark()

Sets this buffer's mark at its position.

reset
Buffer reset()

Resets this buffer's position to the previously-marked position.

clear
Buffer clear()

Clears this buffer. The position is set to zero, the limit is set to the capacity, and the mark is discarded.

flip
Buffer flip()

Flips this buffer. The limit is set to the current position and then the position is set to zero. If the mark is defined then it is discarded.

rewind
Buffer rewind()

Rewinds this buffer. The position is set to zero and the mark is discarded.

remaining
int remaining()

Returns the number of elements between the current position and the limit.

hasRemaining
bool hasRemaining()

Tells whether there are any elements between the current position and the limit.

isReadOnly
bool isReadOnly()

Tells whether or not this buffer is read-only.

hasArray
bool hasArray()

Tells whether or not this buffer is backed by an accessible array.

arrayOffset
int arrayOffset()

Returns the offset within this buffer's backing array of the first element of the buffer&nbsp;&nbsp;<i>(optional operation)</i>.

isDirect
bool isDirect()

Tells whether or not this buffer is <a href="ByteBuffer.html#direct"><i>direct</i></a>.

nextGetIndex
int nextGetIndex()

Checks the current position against the limit, throwing a {@link BufferUnderflowException} if it is not smaller than the limit, and then increments the position.

nextGetIndex
int nextGetIndex(int nb)
Undocumented in source. Be warned that the author may not have intended to support it.
nextPutIndex
int nextPutIndex()

Checks the current position against the limit, throwing a {@link BufferOverflowException} if it is not smaller than the limit, and then increments the position.

nextPutIndex
int nextPutIndex(int nb)
Undocumented in source. Be warned that the author may not have intended to support it.
checkIndex
int checkIndex(int i)

Checks the given index against the limit, throwing an {@link IndexOutOfBoundsException} if it is not smaller than the limit or is smaller than zero.

checkIndex
int checkIndex(int i, int nb)
Undocumented in source. Be warned that the author may not have intended to support it.
markValue
int markValue()
Undocumented in source. Be warned that the author may not have intended to support it.
truncate
void truncate()
Undocumented in source. Be warned that the author may not have intended to support it.
discardMark
void discardMark()
Undocumented in source. Be warned that the author may not have intended to support it.
checkBounds
void checkBounds(int off, int len, int size)
Undocumented in source. Be warned that the author may not have intended to support it.

Meta