public interface ChannelBuf
DataView
if necessary.Modifier and Type | Method and Description |
---|---|
byte[] |
array()
Gets the backing byte array of this stream.
|
int |
available()
Gets the number of bytes available between the reader and the writer.
|
ChannelBuf |
clear()
Sets the readerIndex and writerIndex of this buffer to 0.
|
boolean |
getBoolean(int index)
Gets a boolean at the specified absolute index in this buffer.
|
byte |
getByte(int index)
Gets a byte at the specified absolute index in this buffer.
|
ByteOrder |
getByteOrder()
Returns the endianness (
ByteOrder ) of this buffer. |
int |
getCapacity()
Gets the number of bytes this buffer can contain.
|
char |
getChar(int index)
Gets a character at the specified absolute index in this buffer.
|
DataView |
getDataView(int index)
Gets a
DataView at the specified absolute index in this buffer. |
double |
getDouble(int index)
Gets a double at the specified absolute index in this buffer.
|
float |
getFloat(int index)
Gets a float at the specified absolute index in this buffer.
|
int |
getInteger(int index)
Gets an integer at the specified absolute index in this buffer.
|
long |
getLong(int index)
Gets a long integer at the specified absolute index in this buffer.
|
short |
getShort(int index)
Gets a short integer at the specified absolute index in this buffer.
|
String |
getString(int index)
Gets a string at the specified absolute index in this buffer.
|
UUID |
getUuid(int index)
Gets a
UUID at the specified absolute index in this buffer. |
ChannelBuf |
markRead()
Marks the current readerIndex in this buffer.
|
ChannelBuf |
markWrite()
Marks the current writerIndex in this buffer.
|
ChannelBuf |
order(ByteOrder order)
Returns a buffer with the specified endianness which shares the whole
region, indexes, and marks of this buffer.
|
boolean |
readBoolean()
Gets a boolean at the current readerIndex and increases the
readerIndex by 1 in this buffer.
|
byte |
readByte()
Gets a byte at the current readerIndex and increases the
readerIndex by 1 in this buffer.
|
char |
readChar()
Gets a character at the current readerIndex and increases the
readerIndex by 2 in this buffer.
|
DataView |
readDataView()
Gets a
DataView at the current readerIndex and increases the
readerIndex according to the length of the data view in this buffer. |
double |
readDouble()
Gets a double at the current readerIndex and increases the
readerIndex by 8 in this buffer.
|
int |
readerIndex()
Gets the readerIndex of this buffer.
|
float |
readFloat()
Gets a float at the current readerIndex and increases the
readerIndex by 4 in this buffer.
|
int |
readInteger()
Gets an integer at the current readerIndex and increases the
readerIndex by 4 in this buffer.
|
long |
readLong()
Gets a long integer at the current readerIndex and increases the
readerIndex by 8 in this buffer.
|
short |
readShort()
Gets a short integer at the current readerIndex and increases the
readerIndex by 2 in this buffer.
|
String |
readString()
Gets a string at the current readerIndex and increases the
readerIndex by 1 in this buffer.
|
UUID |
readUuid()
Gets a UUID at the current readerIndex and increases the
readerIndex by 16 in this buffer.
|
ChannelBuf |
resetRead()
Resets the current readerIndex in this buffer to the marked reader
index.
|
ChannelBuf |
resetWrite()
Resets the current writerIndex in this buffer to the marked writer
index.
|
ChannelBuf |
setBoolean(int index,
boolean data)
Sets the boolean at the specified absolute index in this
buffer.
|
ChannelBuf |
setByte(int index,
byte data)
Sets the byte at the specified absolute index in this
buffer.
|
ChannelBuf |
setChar(int index,
char data)
Sets the char at the specified absolute index in this
buffer.
|
ChannelBuf |
setDataView(int index,
DataView data)
Sets the
DataView at the specified absolute index in this
buffer. |
ChannelBuf |
setDouble(int index,
double data)
Sets the double at the specified absolute index in this
buffer.
|
ChannelBuf |
setFloat(int index,
float data)
Sets the float at the specified absolute index in this
buffer.
|
ChannelBuf |
setIndex(int readIndex,
int writeIndex)
Sets both the reader and writer indices.
|
ChannelBuf |
setInteger(int index,
int data)
Sets the integer at the specified absolute index in this
buffer.
|
ChannelBuf |
setLong(int index,
long data)
Sets the long integer at the specified absolute index in this
buffer.
|
ChannelBuf |
setReadIndex(int index)
Sets the readerIndex of this buffer.
|
ChannelBuf |
setShort(int index,
short data)
Sets the short at the specified absolute index in this
buffer.
|
ChannelBuf |
setString(int index,
String data)
Sets the string at the specified absolute index in this
buffer.
|
ChannelBuf |
setUuid(int index,
UUID data)
Sets the
UUID at the specified absolute index in this
buffer. |
ChannelBuf |
setWriteIndex(int index)
Sets the writerIndex of this buffer.
|
ChannelBuf |
slice()
Returns a slice of this buffer's readable bytes.
|
ChannelBuf |
slice(int index,
int length)
Returns a slice of this buffer's sub-region.
|
ChannelBuf |
writeBoolean(boolean data)
Sets the specified boolean at the current writerIndex and increases
the writerIndex by 1 in this buffer.
|
ChannelBuf |
writeByte(byte data)
Sets the specified byte at the current writerIndex and increases
the writerIndex by 1 in this buffer.
|
ChannelBuf |
writeChar(char data)
Sets the specified character at the current writerIndex and
increases the writerIndex by 2 in this buffer.
|
ChannelBuf |
writeDataView(DataView data)
Sets the specified
DataView at the current writerIndex and
increases the writerIndex according to the lenght of the data view
in this buffer. |
ChannelBuf |
writeDouble(double data)
Sets the specified double at the current writerIndex and increases
the writerIndex by 8 in this buffer.
|
ChannelBuf |
writeFloat(float data)
Sets the specified float at the current writerIndex and increases
the writerIndex by 4 in this buffer.
|
ChannelBuf |
writeInteger(int data)
Sets the specified integer at the current writerIndex and increases
the writerIndex by 4 in this buffer.
|
ChannelBuf |
writeLong(long data)
Sets the specified long integer at the current writerIndex and
increases the writerIndex by 8 in this buffer.
|
int |
writerIndex()
Gets the writerIndex of this buffer.
|
ChannelBuf |
writeShort(short data)
Sets the specified short integer at the current writerIndex and
increases the writerIndex by 2 in this buffer.
|
ChannelBuf |
writeString(String data)
Sets the specified string at the current writerIndex and increases
the writerIndex by the length of the string.
|
ChannelBuf |
writeUuid(UUID data)
Sets the specified
UUID at the current writerIndex and
increases the writerIndex by 16 in this buffer. |
int getCapacity()
int available()
ChannelBuf order(ByteOrder order)
If the specified endianness is identical to this buffer's byte order, this method can return this.
This method does not modify readerIndex or writerIndex of this buffer.
order
- The orderByteOrder getByteOrder()
ByteOrder
) of this buffer.int readerIndex()
ChannelBuf setReadIndex(int index)
index
- The new indexint writerIndex()
ChannelBuf setWriteIndex(int index)
index
- The new indexChannelBuf setIndex(int readIndex, int writeIndex)
readIndex
- The reader indexwriteIndex
- The writer indexChannelBuf clear()
setIndex(int, int)
.ChannelBuf markRead()
ChannelBuf markWrite()
ChannelBuf resetRead()
ChannelBuf resetWrite()
ChannelBuf slice()
ChannelBuf slice(int index, int length)
index
- The starter indexlength
- The ending indexbyte[] array()
ChannelBuf writeBoolean(boolean data)
data
- The boolean dataChannelBuf setBoolean(int index, boolean data)
index
- The indexdata
- The boolean databoolean readBoolean()
boolean getBoolean(int index)
index
- The indexChannelBuf writeByte(byte data)
data
- The boolean dataChannelBuf setByte(int index, byte data)
index
- The indexdata
- The boolean databyte readByte()
byte getByte(int index)
index
- The indexChannelBuf writeShort(short data)
data
- The boolean dataChannelBuf setShort(int index, short data)
index
- The indexdata
- The boolean datashort readShort()
short getShort(int index)
index
- The indexChannelBuf writeChar(char data)
data
- The boolean dataChannelBuf setChar(int index, char data)
index
- The indexdata
- The boolean datachar readChar()
char getChar(int index)
index
- The indexChannelBuf writeInteger(int data)
data
- The boolean dataChannelBuf setInteger(int index, int data)
index
- The indexdata
- The boolean dataint readInteger()
int getInteger(int index)
index
- The indexChannelBuf writeLong(long data)
data
- The boolean dataChannelBuf setLong(int index, long data)
index
- The indexdata
- The boolean datalong readLong()
long getLong(int index)
index
- The indexChannelBuf writeFloat(float data)
data
- The boolean dataChannelBuf setFloat(int index, float data)
index
- The indexdata
- The boolean datafloat readFloat()
float getFloat(int index)
index
- The indexChannelBuf writeDouble(double data)
data
- The boolean dataChannelBuf setDouble(int index, double data)
index
- The indexdata
- The boolean datadouble readDouble()
double getDouble(int index)
index
- The indexChannelBuf writeString(String data)
data
- The boolean dataChannelBuf setString(int index, String data)
index
- The indexdata
- The boolean dataString readString()
String getString(int index)
index
- The indexChannelBuf writeUuid(UUID data)
UUID
at the current writerIndex and
increases the writerIndex by 16 in this buffer.data
- The boolean dataChannelBuf setUuid(int index, UUID data)
UUID
at the specified absolute index in this
buffer. This method does not modify readerIndex or writerIndex
of this buffer.index
- The indexdata
- The boolean dataUUID readUuid()
UUID getUuid(int index)
UUID
at the specified absolute index in this buffer.index
- The indexChannelBuf writeDataView(DataView data)
DataView
at the current writerIndex and
increases the writerIndex according to the lenght of the data view
in this buffer.data
- The boolean dataChannelBuf setDataView(int index, DataView data)
DataView
at the specified absolute index in this
buffer. This method does not modify readerIndex or writerIndex
of this buffer.index
- The indexdata
- The boolean dataDataView readDataView()
DataView
at the current readerIndex and increases the
readerIndex according to the length of the data view in this buffer.