public final class ByteBuffer
extends com.google.gwt.core.client.JavaScriptObject
Modifier | Constructor and Description |
---|---|
protected |
ByteBuffer() |
Modifier and Type | Method and Description |
---|---|
static ByteBuffer |
allocate(int capacity)
Allocates a new ByteBuffer instance.
|
ByteBuffer |
clear()
Clears the buffer.
|
ByteBuffer |
compact()
Compacts the buffer by removing leading bytes up to the buffer position, and
decrements the limit and position values accordingly.
|
static ByteBuffer |
create()
Creates a new ByteBuffer instance.
|
static ByteBuffer |
create(com.google.gwt.core.client.JsArrayInteger[] bytes)
Creates a new ByteBuffer instance with bytes as underlying array.
|
ByteBuffer |
duplicate()
Duplicates the buffer by reusing the underlying byte array but with independent
position, limit and capacity.
|
ByteBuffer |
expand(int expectedRemaining)
Expands the buffer to support the expected number of remaining bytes after the current position.
|
ByteBuffer |
expandAt(int i,
int expectedRemaining)
Expands the buffer to support the expected number of remaining bytes at the specified index.
|
ByteBuffer |
fill(int size)
Fills the buffer with a repeated number of zeros.
|
ByteBuffer |
fillWith(byte b,
int size)
Fills the buffer with a specific number of repeated bytes.
|
ByteBuffer |
flip()
Flips the buffer.
|
byte |
get()
Returns a single byte from the buffer at the current position.
|
void |
get(byte[] dst,
int offset,
int size) |
com.google.gwt.core.client.JsArrayInteger |
getArray()
The array property provides byte storage for the buffer.
|
int |
getArrayBuffer(int size)
Returns an ArrayBuffer from the buffer at the current position.
|
byte |
getAt(int i)
Returns a single byte from the buffer at the specified index.
|
boolean |
getAutoExpand()
The autoExpand property enables writing variable length data, and is on by default.
|
byte[] |
getBytes() |
byte[] |
getBytes(int size) |
int |
getCapacity()
The capacity property indicates the maximum number of bytes of storage
available if the buffer is not automatically expanding.
|
String |
getHexDump()
Returns a hex dump of this buffer.
|
int |
getInt()
Returns a 4-byte number from the buffer at the current position.
|
int |
getIntAt(int i)
Returns a 4-byte number from the buffer at the specified index.
|
int |
getLong()
Returns a 4-byte number from the buffer at the current position.
|
int |
getMediumInt()
Returns a 3-byte number from the buffer at the current position.
|
int |
getMediumIntAt(int i)
Returns a 3-byte number from the buffer at the specified index.
|
ByteOrder |
getOrder()
The order property indicates the endianness of multibyte integer types in the buffer.
|
String |
getPrefixedString(int fieldSize,
Charset cs)
Returns a length-prefixed string from the buffer at the current position.
|
short |
getShort()
Returns a 2-byte number from the buffer at the current position.
|
int |
getShortAt(int i)
Returns a 2-byte number from the buffer at the specified index.
|
String |
getString(Charset cs)
Returns a null-terminated string from the buffer at the current position.
|
int |
getUnsigned()
Returns an unsigned single-byte number from the buffer at the current position.
|
int |
getUnsignedInt()
Returns an unsigned 4-byte number from the buffer at the current position.
|
int |
getUnsignedMediumInt()
Returns an unsigned 3-byte number from the buffer at the current position.
|
int |
getUnsignedShort()
Returns an unsigned 2-byte number from the buffer at the current position.
|
boolean |
hasRemaining()
Returns true if this buffer has remaining bytes, false otherwise.
|
int |
indexOf(byte b)
Returns the index of the specified byte in the buffer.
|
int |
limit()
The limit property indicates the last byte of data available for reading.
|
void |
limit(int newLimit) |
ByteBuffer |
mark()
Marks a position in the buffer.
|
int |
position()
The position property indicates the progress through the buffer, and indicates
the position within the underlying array that subsequent data will be read from
or written to.
|
void |
position(int newPosition) |
ByteBuffer |
put(byte v)
Puts a single byte number into the buffer at the current position.
|
ByteBuffer |
putAt(int i,
byte v)
Puts a single byte number into the buffer at the specified index.
|
ByteBuffer |
putBuffer(ByteBuffer v)
Puts a buffer into the buffer at the current position.
|
ByteBuffer |
putBufferAt(int i,
ByteBuffer v)
Puts a buffer into the buffer at the specified index.
|
ByteBuffer |
putBytes(byte[] v)
Puts a single-byte array into the buffer at the current position.
|
ByteBuffer |
putBytesAt(int i,
byte[] v)
Puts a byte array into the buffer at the specified index.
|
ByteBuffer |
putInt(int v)
Puts a 4-byte number into the buffer at the current position.
|
ByteBuffer |
putIntAt(int i,
int v)
Puts a 4-byte number into the buffer at the specified index.
|
ByteBuffer |
putLong(long v)
Puts a 8-byte number into the buffer at the current position.
|
ByteBuffer |
putLongAt(int i,
long v)
Puts a 8-byte number into the buffer at the specified index.
|
ByteBuffer |
putMediumInt(int v)
Puts a 3-byte number into the buffer at the current position.
|
ByteBuffer |
putMediumIntAt(int i,
int v)
Puts a 3-byte number into the buffer at the specified index.
|
ByteBuffer |
putPrefixedString(int fieldSize,
int v,
Charset cs)
Puts a string into the buffer at the specified index, using the character set to
encode the string as bytes.
|
ByteBuffer |
putShort(short v)
Puts a 2-byte number into the buffer at the current position.
|
ByteBuffer |
putShortAt(int i,
short v)
Puts a 2-byte number into the buffer at the specified index.
|
ByteBuffer |
putString(String v,
Charset cs)
Puts a string into the buffer at the current position, using the character set to
encode the string as bytes.
|
ByteBuffer |
putUnsignedShort(short v)
Puts a two-byte array into the buffer at the current position.
|
int |
remaining()
Returns the number of bytes remaining from the current position to the limit.
|
void |
remaining(int newRemaining) |
ByteBuffer |
reset()
Resets the buffer position using the mark.
|
ByteBuffer |
rewind()
Rewinds the buffer.
|
ByteBuffer |
skip(int size)
Skips the specified number of bytes from the current position.
|
ByteBuffer |
slice()
Returns a sliced buffer, setting the position to zero, and decrementing the limit accordingly.
|
static ByteBuffer |
wrap(byte[] bytes)
Wraps a byte array as a new ByteBuffer instance.
|
public static ByteBuffer create()
public static ByteBuffer create(com.google.gwt.core.client.JsArrayInteger[] bytes)
public com.google.gwt.core.client.JsArrayInteger getArray()
public byte[] getBytes()
public boolean getAutoExpand()
public int getCapacity()
public int limit()
public void limit(int newLimit)
public ByteOrder getOrder()
public int position()
public void position(int newPosition)
public static ByteBuffer allocate(int capacity)
public ByteBuffer clear()
public ByteBuffer compact()
public ByteBuffer duplicate()
public ByteBuffer expand(int expectedRemaining)
public ByteBuffer expandAt(int i, int expectedRemaining)
public ByteBuffer fill(int size)
public ByteBuffer fillWith(byte b, int size)
public ByteBuffer flip()
public byte get()
public byte[] getBytes(int size)
public void get(byte[] dst, int offset, int size)
public byte getAt(int i)
public String getHexDump()
public int getInt()
public int getIntAt(int i)
public int getMediumInt()
public int getMediumIntAt(int i)
public String getPrefixedString(int fieldSize, Charset cs)
public int getLong()
public short getShort()
public int getShortAt(int i)
public String getString(Charset cs)
public int getUnsigned()
public int getUnsignedInt()
public int getUnsignedMediumInt()
public int getUnsignedShort()
public int getArrayBuffer(int size)
public boolean hasRemaining()
public int indexOf(byte b)
public ByteBuffer mark()
public ByteBuffer put(byte v)
public ByteBuffer putAt(int i, byte v)
public ByteBuffer putBuffer(ByteBuffer v)
public ByteBuffer putBufferAt(int i, ByteBuffer v)
public ByteBuffer putBytes(byte[] v)
public ByteBuffer putBytesAt(int i, byte[] v)
public ByteBuffer putInt(int v)
public ByteBuffer putIntAt(int i, int v)
public ByteBuffer putMediumInt(int v)
public ByteBuffer putMediumIntAt(int i, int v)
public ByteBuffer putPrefixedString(int fieldSize, int v, Charset cs)
public ByteBuffer putLong(long v)
public ByteBuffer putLongAt(int i, long v)
public ByteBuffer putShort(short v)
public ByteBuffer putShortAt(int i, short v)
public ByteBuffer putUnsignedShort(short v)
public ByteBuffer putString(String v, Charset cs)
public int remaining()
public void remaining(int newRemaining)
public ByteBuffer reset()
public ByteBuffer rewind()
public ByteBuffer skip(int size)
public ByteBuffer slice()
public static ByteBuffer wrap(byte[] bytes)
Copyright © 2015. All Rights Reserved.