Interface Buffer
-
- All Superinterfaces:
ClusterSerializable,Shareable
public interface Buffer extends ClusterSerializable, Shareable
Most data is shuffled around inside Vert.x using buffers.A buffer is a sequence of zero or more bytes that can read from or written to and which expands automatically as necessary to accommodate any bytes written to it. You can perhaps think of a buffer as smart byte array.
Please consult the documentation for more information on buffers.
- Author:
- Tim Fox
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description BufferappendBuffer(Buffer buff)Appends the specifiedBufferto the end of this Buffer.BufferappendBuffer(Buffer buff, int offset, int len)Appends the specifiedBufferstarting at theoffsetusinglento the end of this Buffer.BufferappendByte(byte b)Appends the specifiedbyteto the end of the Buffer.BufferappendBytes(byte[] bytes)Appends the specifiedbyte[]to the end of the Buffer.BufferappendBytes(byte[] bytes, int offset, int len)Appends the specified number of bytes frombyte[]to the end of the Buffer, starting at the given offset.BufferappendDouble(double d)Appends the specifieddoubleto the end of the Buffer.BufferappendDoubleLE(double d)Appends the specified unsigneddoubleto the end of the Buffer in the Little Endian Byte Order.The buffer will expand as necessary to accommodate any bytes written.BufferappendFloat(float f)Appends the specifiedfloatto the end of the Buffer.BufferappendFloatLE(float f)Appends the specified unsignedfloatto the end of the Buffer in the Little Endian Byte Order.The buffer will expand as necessary to accommodate any bytes written.BufferappendInt(int i)Appends the specifiedintto the end of the Buffer.BufferappendIntLE(int i)Appends the specifiedintto the end of the Buffer in the Little Endian Byte Order.BufferappendLong(long l)Appends the specifiedlongto the end of the Buffer.BufferappendLongLE(long l)Appends the specifiedlongto the end of the Buffer in the Little Endian Byte Order.BufferappendMedium(int i)Appends the specified 24bitintto the end of the Buffer.BufferappendMediumLE(int i)Appends the specified 24bitintto the end of the Buffer in the Little Endian Byte Order.BufferappendShort(short s)Appends the specifiedshortto the end of the Buffer.The buffer will expand as necessary to accommodate any bytes written.BufferappendShortLE(short s)Appends the specifiedshortto the end of the Buffer in the Little Endian Byte Order.The buffer will expand as necessary to accommodate any bytes written.BufferappendString(String str)Appends the specifiedString strto the end of the Buffer with UTF-8 encoding.BufferappendString(String str, String enc)Appends the specifiedStringto the end of the Buffer with the encoding as specified byenc.BufferappendUnsignedByte(short b)Appends the specified unsignedbyteto the end of the Buffer.BufferappendUnsignedInt(long i)Appends the specified unsignedintto the end of the Buffer.BufferappendUnsignedIntLE(long i)Appends the specified unsignedintto the end of the Buffer in the Little Endian Byte Order.BufferappendUnsignedShort(int s)Appends the specified unsignedshortto the end of the Buffer.The buffer will expand as necessary to accommodate any bytes written.BufferappendUnsignedShortLE(int s)Appends the specified unsignedshortto the end of the Buffer in the Little Endian Byte Order.The buffer will expand as necessary to accommodate any bytes written.static Bufferbuffer()Create a new, empty buffer.static Bufferbuffer(byte[] bytes)Create a new buffer from a byte[].static Bufferbuffer(int initialSizeHint)Create a new buffer given the initial size hint.static Bufferbuffer(String string)Create a new buffer from a string.static Bufferbuffer(String string, String enc)Create a new buffer from a string and using the specified encoding.Buffercopy()Returns a copy of the entire Buffer.static BufferfromJson(String value)Create a buffer from the base 64 URL encodedvalueBuffergetBuffer(int start, int end)Returns a copy of a sub-sequence the Buffer as aBufferstarting at positionstartand ending at positionend - 1bytegetByte(int pos)Returns thebyteat positionposin the Buffer.byte[]getBytes()Returns a copy of the entire Buffer as abyte[]BuffergetBytes(byte[] dst)Transfers the content of the Buffer into abyte[].BuffergetBytes(byte[] dst, int dstIndex)Transfers the content of the Buffer into abyte[]at the specific destination.byte[]getBytes(int start, int end)Returns a copy of a sub-sequence the Buffer as abyte[]starting at positionstartand ending at positionend - 1BuffergetBytes(int start, int end, byte[] dst)Transfers the content of the Buffer starting at positionstartand ending at positionend - 1into abyte[].BuffergetBytes(int start, int end, byte[] dst, int dstIndex)Transfers the content of the Buffer starting at positionstartand ending at positionend - 1into abyte[]at the specific destination.doublegetDouble(int pos)Returns thedoubleat positionposin the Buffer.doublegetDoubleLE(int pos)Gets a double at the specified absoluteindexin this buffer in Little Endian Byte Order.floatgetFloat(int pos)Returns thefloatat positionposin the Buffer.floatgetFloatLE(int pos)Gets a float at the specified absoluteindexin this buffer in Little Endian Byte Order.intgetInt(int pos)Returns theintat positionposin the Buffer.intgetIntLE(int pos)Gets a 32-bit integer at the specified absoluteindexin this buffer with Little Endian Byte Order.longgetLong(int pos)Returns thelongat positionposin the Buffer.longgetLongLE(int pos)Gets a 64-bit long integer at the specified absoluteindexin this buffer in Little Endian Byte Order.intgetMedium(int pos)Gets a 24-bit medium integer at the specified absoluteindexin this buffer.intgetMediumLE(int pos)Gets a 24-bit medium integer at the specified absoluteindexin this buffer in the Little Endian Byte Order.shortgetShort(int pos)Returns theshortat positionposin the Buffer.shortgetShortLE(int pos)Gets a 16-bit short integer at the specified absoluteindexin this buffer in Little Endian Byte Order.StringgetString(int start, int end)Returns a copy of a sub-sequence the Buffer as aStringstarting at positionstartand ending at positionend - 1interpreted as a String in UTF-8 encodingStringgetString(int start, int end, String enc)Returns a copy of a sub-sequence the Buffer as aStringstarting at positionstartand ending at positionend - 1interpreted as a String in the specified encodingshortgetUnsignedByte(int pos)Returns the unsignedbyteat positionposin the Buffer, as ashort.longgetUnsignedInt(int pos)Returns the unsignedintat positionposin the Buffer, as along.longgetUnsignedIntLE(int pos)Returns the unsignedintat positionposin the Buffer, as alongin Little Endian Byte Order.intgetUnsignedMedium(int pos)Gets an unsigned 24-bit medium integer at the specified absoluteindexin this buffer.intgetUnsignedMediumLE(int pos)Gets an unsigned 24-bit medium integer at the specified absoluteindexin this buffer in Little Endian Byte Order.intgetUnsignedShort(int pos)Returns the unsignedshortat positionposin the Buffer, as anint.intgetUnsignedShortLE(int pos)Gets an unsigned 16-bit short integer at the specified absoluteindexin this buffer in Little Endian Byte Order.intlength()Returns the length of the buffer, measured in bytes.BuffersetBuffer(int pos, Buffer b)Sets the bytes at positionposin the Buffer to the bytes represented by theBuffer b.BuffersetBuffer(int pos, Buffer b, int offset, int len)Sets the bytes at positionposin the Buffer to the bytes represented by theBuffer bon the givenoffsetandlen.BuffersetByte(int pos, byte b)Sets thebyteat positionposin the Buffer to the valueb.BuffersetBytes(int pos, byte[] b)Sets the bytes at positionposin the Buffer to the bytes represented by thebyte[] b.BuffersetBytes(int pos, byte[] b, int offset, int len)Sets the given number of bytes at positionposin the Buffer to the bytes represented by thebyte[] b.BuffersetBytes(int pos, ByteBuffer b)Sets the bytes at positionposin the Buffer to the bytes represented by theByteBuffer b.BuffersetDouble(int pos, double d)Sets thedoubleat positionposin the Buffer to the valued.BuffersetDoubleLE(int pos, double d)Sets thedoubleat positionposin the Buffer to the valuedin the Little Endian Byte Order.BuffersetFloat(int pos, float f)Sets thefloatat positionposin the Buffer to the valuef.BuffersetFloatLE(int pos, float f)Sets thefloatat positionposin the Buffer to the valuefin the Little Endian Byte Order.BuffersetInt(int pos, int i)Sets theintat positionposin the Buffer to the valuei.BuffersetIntLE(int pos, int i)Sets theintat positionposin the Buffer to the valueiin the Little Endian Byte Order.BuffersetLong(int pos, long l)Sets thelongat positionposin the Buffer to the valuel.BuffersetLongLE(int pos, long l)Sets thelongat positionposin the Buffer to the valuelin the Little Endian Byte Order.BuffersetMedium(int pos, int i)Sets the 24bitintat positionposin the Buffer to the valuei.BuffersetMediumLE(int pos, int i)Sets the 24bitintat positionposin the Buffer to the valuei. in the Little Endian Byte OrderBuffersetShort(int pos, short s)Sets theshortat positionposin the Buffer to the values.BuffersetShortLE(int pos, short s)Sets theshortat positionposin the Buffer to the valuesin the Little Endian Byte Order.BuffersetString(int pos, String str)Sets the bytes at positionposin the Buffer to the value ofstrencoded in UTF-8.BuffersetString(int pos, String str, String enc)Sets the bytes at positionposin the Buffer to the value ofstrencoded in encodingenc.BuffersetUnsignedByte(int pos, short b)Sets the unsignedbyteat positionposin the Buffer to the valueb.BuffersetUnsignedInt(int pos, long i)Sets the unsignedintat positionposin the Buffer to the valuei.BuffersetUnsignedIntLE(int pos, long i)Sets the unsignedintat positionposin the Buffer to the valueiin the Little Endian Byte Order.BuffersetUnsignedShort(int pos, int s)Sets the unsignedshortat positionposin the Buffer to the values.BuffersetUnsignedShortLE(int pos, int s)Sets the unsignedshortat positionposin the Buffer to the valuesin the Little Endian Byte Order.Bufferslice()Returns a slice of this buffer.Bufferslice(int start, int end)Returns a slice of this buffer.default StringtoJson()Encode the buffer bytes to their base 64 URL encoded representation.JsonArraytoJsonArray()Returns aJsonArrayrepresentation of this buffer's content.JsonObjecttoJsonObject()Returns aJsonObjectrepresentation of this buffer's content.default ObjecttoJsonValue()Returns a Json value representation of this buffer's content.StringtoString()Returns aStringrepresentation of the Buffer with theUTF-8encodingStringtoString(String enc)Returns aStringrepresentation of the Buffer with the encoding specified byencStringtoString(Charset enc)Returns aStringrepresentation of the Buffer with the encoding specified byenc-
Methods inherited from interface io.vertx.core.shareddata.ClusterSerializable
readFromBuffer, writeToBuffer
-
-
-
-
Method Detail
-
fromJson
static Buffer fromJson(String value)
Create a buffer from the base 64 URL encodedvalue- Parameters:
value- the base64 encoded value- Returns:
- the buffer
-
buffer
static Buffer buffer()
Create a new, empty buffer.- Returns:
- the buffer
-
buffer
static Buffer buffer(int initialSizeHint)
Create a new buffer given the initial size hint.If you know the buffer will require a certain size, providing the hint can prevent unnecessary re-allocations as the buffer is written to and resized.
- Parameters:
initialSizeHint- the hint, in bytes- Returns:
- the buffer
-
buffer
static Buffer buffer(String string)
Create a new buffer from a string. The string will be UTF-8 encoded into the buffer.- Parameters:
string- the string- Returns:
- the buffer
-
buffer
static Buffer buffer(String string, String enc)
Create a new buffer from a string and using the specified encoding. The string will be encoded into the buffer using the specified encoding.- Parameters:
string- the string- Returns:
- the buffer
-
buffer
static Buffer buffer(byte[] bytes)
Create a new buffer from a byte[]. The byte[] will be copied to form the buffer.- Parameters:
bytes- the byte array- Returns:
- the buffer
-
toString
String toString()
Returns aStringrepresentation of the Buffer with theUTF-8encoding
-
toString
String toString(String enc)
Returns aStringrepresentation of the Buffer with the encoding specified byenc
-
toString
String toString(Charset enc)
Returns aStringrepresentation of the Buffer with the encoding specified byenc
-
toJsonObject
JsonObject toJsonObject()
Returns aJsonObjectrepresentation of this buffer's content.
-
toJsonValue
default Object toJsonValue()
Returns a Json value representation of this buffer's content.- Returns:
- a Json value which can be a
JsonArray,JsonObject,String, ... if the buffer contains an array, object, string, ...etc
-
toJson
default String toJson()
Encode the buffer bytes to their base 64 URL encoded representation.
-
getByte
byte getByte(int pos)
Returns thebyteat positionposin the Buffer.- Throws:
IndexOutOfBoundsException- if the specifiedposis less than0orpos + 1is greater than the length of the Buffer.
-
getUnsignedByte
short getUnsignedByte(int pos)
Returns the unsignedbyteat positionposin the Buffer, as ashort.- Throws:
IndexOutOfBoundsException- if the specifiedposis less than0orpos + 1is greater than the length of the Buffer.
-
getInt
int getInt(int pos)
Returns theintat positionposin the Buffer.- Throws:
IndexOutOfBoundsException- if the specifiedposis less than0orpos + 4is greater than the length of the Buffer.
-
getIntLE
int getIntLE(int pos)
Gets a 32-bit integer at the specified absoluteindexin this buffer with Little Endian Byte Order.- Throws:
IndexOutOfBoundsException- if the specifiedindexis less than0orindex + 4is greater thanthis.capacity
-
getUnsignedInt
long getUnsignedInt(int pos)
Returns the unsignedintat positionposin the Buffer, as along.- Throws:
IndexOutOfBoundsException- if the specifiedposis less than0orpos + 4is greater than the length of the Buffer.
-
getUnsignedIntLE
long getUnsignedIntLE(int pos)
Returns the unsignedintat positionposin the Buffer, as alongin Little Endian Byte Order.- Throws:
IndexOutOfBoundsException- if the specifiedposis less than0orpos + 4is greater than the length of the Buffer.
-
getLong
long getLong(int pos)
Returns thelongat positionposin the Buffer.- Throws:
IndexOutOfBoundsException- if the specifiedposis less than0orpos + 8is greater than the length of the Buffer.
-
getLongLE
long getLongLE(int pos)
Gets a 64-bit long integer at the specified absoluteindexin this buffer in Little Endian Byte Order.- Throws:
IndexOutOfBoundsException- if the specifiedindexis less than0orindex + 8is greater than the length of the Buffer.
-
getDouble
double getDouble(int pos)
Returns thedoubleat positionposin the Buffer.- Throws:
IndexOutOfBoundsException- if the specifiedposis less than0orpos + 8is greater than the length of the Buffer.
-
getDoubleLE
double getDoubleLE(int pos)
Gets a double at the specified absoluteindexin this buffer in Little Endian Byte Order.- Throws:
IndexOutOfBoundsException- if the specifiedposis less than0orpos + 8is greater than the length of the Buffer.
-
getFloat
float getFloat(int pos)
Returns thefloatat positionposin the Buffer.- Throws:
IndexOutOfBoundsException- if the specifiedposis less than0orpos + 4is greater than the length of the Buffer.
-
getFloatLE
float getFloatLE(int pos)
Gets a float at the specified absoluteindexin this buffer in Little Endian Byte Order.- Throws:
IndexOutOfBoundsException- if the specifiedposis less than0orpos + 4is greater than the length of the Buffer.
-
getShort
short getShort(int pos)
Returns theshortat positionposin the Buffer.- Throws:
IndexOutOfBoundsException- if the specifiedposis less than0orpos + 2is greater than the length of the Buffer.
-
getShortLE
short getShortLE(int pos)
Gets a 16-bit short integer at the specified absoluteindexin this buffer in Little Endian Byte Order.- Throws:
IndexOutOfBoundsException- if the specifiedindexis less than0orindex + 2is greater than the length of the Buffer.
-
getUnsignedShort
int getUnsignedShort(int pos)
Returns the unsignedshortat positionposin the Buffer, as anint.- Throws:
IndexOutOfBoundsException- if the specifiedposis less than0orpos + 2is greater than the length of the Buffer.
-
getUnsignedShortLE
int getUnsignedShortLE(int pos)
Gets an unsigned 16-bit short integer at the specified absoluteindexin this buffer in Little Endian Byte Order.- Throws:
IndexOutOfBoundsException- if the specifiedindexis less than0orindex + 2is greater than the length of the Buffer.
-
getMedium
int getMedium(int pos)
Gets a 24-bit medium integer at the specified absoluteindexin this buffer.- Throws:
IndexOutOfBoundsException- if the specifiedindexis less than0orindex + 3is greater than the length of the Buffer.
-
getMediumLE
int getMediumLE(int pos)
Gets a 24-bit medium integer at the specified absoluteindexin this buffer in the Little Endian Byte Order.- Throws:
IndexOutOfBoundsException- if the specifiedindexis less than0orindex + 3is greater than the length of the Buffer.
-
getUnsignedMedium
int getUnsignedMedium(int pos)
Gets an unsigned 24-bit medium integer at the specified absoluteindexin this buffer.- Throws:
IndexOutOfBoundsException- if the specifiedindexis less than0orindex + 3is greater than the length of the Buffer.
-
getUnsignedMediumLE
int getUnsignedMediumLE(int pos)
Gets an unsigned 24-bit medium integer at the specified absoluteindexin this buffer in Little Endian Byte Order.- Throws:
IndexOutOfBoundsException- if the specifiedindexis less than0orindex + 3is greater than the length of the Buffer.
-
getBytes
byte[] getBytes()
Returns a copy of the entire Buffer as abyte[]
-
getBytes
byte[] getBytes(int start, int end)Returns a copy of a sub-sequence the Buffer as abyte[]starting at positionstartand ending at positionend - 1
-
getBytes
Buffer getBytes(byte[] dst)
Transfers the content of the Buffer into abyte[].- Parameters:
dst- the destination byte array- Throws:
IndexOutOfBoundsException- if the content of the Buffer cannot fit into the destination byte array
-
getBytes
Buffer getBytes(byte[] dst, int dstIndex)
Transfers the content of the Buffer into abyte[]at the specific destination.- Parameters:
dst- the destination byte array- Throws:
IndexOutOfBoundsException- if the content of the Buffer cannot fit into the destination byte array
-
getBytes
Buffer getBytes(int start, int end, byte[] dst)
Transfers the content of the Buffer starting at positionstartand ending at positionend - 1into abyte[].- Parameters:
dst- the destination byte array- Throws:
IndexOutOfBoundsException- if the content of the Buffer cannot fit into the destination byte array
-
getBytes
Buffer getBytes(int start, int end, byte[] dst, int dstIndex)
Transfers the content of the Buffer starting at positionstartand ending at positionend - 1into abyte[]at the specific destination.- Parameters:
dst- the destination byte array- Throws:
IndexOutOfBoundsException- if the content of the Buffer cannot fit into the destination byte array
-
getBuffer
Buffer getBuffer(int start, int end)
Returns a copy of a sub-sequence the Buffer as aBufferstarting at positionstartand ending at positionend - 1
-
getString
String getString(int start, int end, String enc)
Returns a copy of a sub-sequence the Buffer as aStringstarting at positionstartand ending at positionend - 1interpreted as a String in the specified encoding
-
getString
String getString(int start, int end)
Returns a copy of a sub-sequence the Buffer as aStringstarting at positionstartand ending at positionend - 1interpreted as a String in UTF-8 encoding
-
appendBuffer
Buffer appendBuffer(Buffer buff)
Appends the specifiedBufferto the end of this Buffer. The buffer will expand as necessary to accommodate any bytes written.Returns a reference to
thisso multiple operations can be appended together.
-
appendBuffer
Buffer appendBuffer(Buffer buff, int offset, int len)
Appends the specifiedBufferstarting at theoffsetusinglento the end of this Buffer. The buffer will expand as necessary to accommodate any bytes written.Returns a reference to
thisso multiple operations can be appended together.
-
appendBytes
Buffer appendBytes(byte[] bytes)
Appends the specifiedbyte[]to the end of the Buffer. The buffer will expand as necessary to accommodate any bytes written.Returns a reference to
thisso multiple operations can be appended together.
-
appendBytes
Buffer appendBytes(byte[] bytes, int offset, int len)
Appends the specified number of bytes frombyte[]to the end of the Buffer, starting at the given offset. The buffer will expand as necessary to accommodate any bytes written.Returns a reference to
thisso multiple operations can be appended together.
-
appendByte
Buffer appendByte(byte b)
Appends the specifiedbyteto the end of the Buffer. The buffer will expand as necessary to accommodate any bytes written.Returns a reference to
thisso multiple operations can be appended together.
-
appendUnsignedByte
Buffer appendUnsignedByte(short b)
Appends the specified unsignedbyteto the end of the Buffer. The buffer will expand as necessary to accommodate any bytes written.Returns a reference to
thisso multiple operations can be appended together.
-
appendInt
Buffer appendInt(int i)
Appends the specifiedintto the end of the Buffer. The buffer will expand as necessary to accommodate any bytes written.Returns a reference to
thisso multiple operations can be appended together.
-
appendIntLE
Buffer appendIntLE(int i)
Appends the specifiedintto the end of the Buffer in the Little Endian Byte Order. The buffer will expand as necessary to accommodate any bytes written.Returns a reference to
thisso multiple operations can be appended together.
-
appendUnsignedInt
Buffer appendUnsignedInt(long i)
Appends the specified unsignedintto the end of the Buffer. The buffer will expand as necessary to accommodate any bytes written.Returns a reference to
thisso multiple operations can be appended together.
-
appendUnsignedIntLE
Buffer appendUnsignedIntLE(long i)
Appends the specified unsignedintto the end of the Buffer in the Little Endian Byte Order. The buffer will expand as necessary to accommodate any bytes written.Returns a reference to
thisso multiple operations can be appended together.
-
appendMedium
Buffer appendMedium(int i)
Appends the specified 24bitintto the end of the Buffer. The buffer will expand as necessary to accommodate any bytes written.Returns a reference to
thisso multiple operations can be appended together.
-
appendMediumLE
Buffer appendMediumLE(int i)
Appends the specified 24bitintto the end of the Buffer in the Little Endian Byte Order. The buffer will expand as necessary to accommodate any bytes written.Returns a reference to
thisso multiple operations can be appended together.
-
appendLong
Buffer appendLong(long l)
Appends the specifiedlongto the end of the Buffer. The buffer will expand as necessary to accommodate any bytes written.Returns a reference to
thisso multiple operations can be appended together.
-
appendLongLE
Buffer appendLongLE(long l)
Appends the specifiedlongto the end of the Buffer in the Little Endian Byte Order. The buffer will expand as necessary to accommodate any bytes written.Returns a reference to
thisso multiple operations can be appended together.
-
appendShort
Buffer appendShort(short s)
Appends the specifiedshortto the end of the Buffer.The buffer will expand as necessary to accommodate any bytes written.Returns a reference to
thisso multiple operations can be appended together.
-
appendShortLE
Buffer appendShortLE(short s)
Appends the specifiedshortto the end of the Buffer in the Little Endian Byte Order.The buffer will expand as necessary to accommodate any bytes written.Returns a reference to
thisso multiple operations can be appended together.
-
appendUnsignedShort
Buffer appendUnsignedShort(int s)
Appends the specified unsignedshortto the end of the Buffer.The buffer will expand as necessary to accommodate any bytes written.Returns a reference to
thisso multiple operations can be appended together.
-
appendUnsignedShortLE
Buffer appendUnsignedShortLE(int s)
Appends the specified unsignedshortto the end of the Buffer in the Little Endian Byte Order.The buffer will expand as necessary to accommodate any bytes written.Returns a reference to
thisso multiple operations can be appended together.
-
appendFloat
Buffer appendFloat(float f)
Appends the specifiedfloatto the end of the Buffer. The buffer will expand as necessary to accommodate any bytes written.Returns a reference to
thisso multiple operations can be appended together.
-
appendFloatLE
Buffer appendFloatLE(float f)
Appends the specified unsignedfloatto the end of the Buffer in the Little Endian Byte Order.The buffer will expand as necessary to accommodate any bytes written.Returns a reference to
thisso multiple operations can be appended together.
-
appendDouble
Buffer appendDouble(double d)
Appends the specifieddoubleto the end of the Buffer. The buffer will expand as necessary to accommodate any bytes written.Returns a reference to
thisso multiple operations can be appended together.
-
appendDoubleLE
Buffer appendDoubleLE(double d)
Appends the specified unsigneddoubleto the end of the Buffer in the Little Endian Byte Order.The buffer will expand as necessary to accommodate any bytes written.Returns a reference to
thisso multiple operations can be appended together.
-
appendString
Buffer appendString(String str, String enc)
Appends the specifiedStringto the end of the Buffer with the encoding as specified byenc.The buffer will expand as necessary to accommodate any bytes written.
Returns a reference to
thisso multiple operations can be appended together.
-
appendString
Buffer appendString(String str)
Appends the specifiedString strto the end of the Buffer with UTF-8 encoding.The buffer will expand as necessary to accommodate any bytes written.
Returns a reference to
thisso multiple operations can be appended together
-
setByte
Buffer setByte(int pos, byte b)
Sets thebyteat positionposin the Buffer to the valueb.The buffer will expand as necessary to accommodate any value written.
-
setUnsignedByte
Buffer setUnsignedByte(int pos, short b)
Sets the unsignedbyteat positionposin the Buffer to the valueb.The buffer will expand as necessary to accommodate any value written.
-
setInt
Buffer setInt(int pos, int i)
Sets theintat positionposin the Buffer to the valuei.The buffer will expand as necessary to accommodate any value written.
-
setIntLE
Buffer setIntLE(int pos, int i)
Sets theintat positionposin the Buffer to the valueiin the Little Endian Byte Order.The buffer will expand as necessary to accommodate any value written.
-
setUnsignedInt
Buffer setUnsignedInt(int pos, long i)
Sets the unsignedintat positionposin the Buffer to the valuei.The buffer will expand as necessary to accommodate any value written.
-
setUnsignedIntLE
Buffer setUnsignedIntLE(int pos, long i)
Sets the unsignedintat positionposin the Buffer to the valueiin the Little Endian Byte Order.The buffer will expand as necessary to accommodate any value written.
-
setMedium
Buffer setMedium(int pos, int i)
Sets the 24bitintat positionposin the Buffer to the valuei.The buffer will expand as necessary to accommodate any value written.
-
setMediumLE
Buffer setMediumLE(int pos, int i)
Sets the 24bitintat positionposin the Buffer to the valuei. in the Little Endian Byte OrderThe buffer will expand as necessary to accommodate any value written.
-
setLong
Buffer setLong(int pos, long l)
Sets thelongat positionposin the Buffer to the valuel.The buffer will expand as necessary to accommodate any value written.
-
setLongLE
Buffer setLongLE(int pos, long l)
Sets thelongat positionposin the Buffer to the valuelin the Little Endian Byte Order.The buffer will expand as necessary to accommodate any value written.
-
setDouble
Buffer setDouble(int pos, double d)
Sets thedoubleat positionposin the Buffer to the valued.The buffer will expand as necessary to accommodate any value written.
-
setDoubleLE
Buffer setDoubleLE(int pos, double d)
Sets thedoubleat positionposin the Buffer to the valuedin the Little Endian Byte Order.The buffer will expand as necessary to accommodate any value written.
-
setFloat
Buffer setFloat(int pos, float f)
Sets thefloatat positionposin the Buffer to the valuef.The buffer will expand as necessary to accommodate any value written.
-
setFloatLE
Buffer setFloatLE(int pos, float f)
Sets thefloatat positionposin the Buffer to the valuefin the Little Endian Byte Order.The buffer will expand as necessary to accommodate any value written.
-
setShort
Buffer setShort(int pos, short s)
Sets theshortat positionposin the Buffer to the values.The buffer will expand as necessary to accommodate any value written.
-
setShortLE
Buffer setShortLE(int pos, short s)
Sets theshortat positionposin the Buffer to the valuesin the Little Endian Byte Order.The buffer will expand as necessary to accommodate any value written.
-
setUnsignedShort
Buffer setUnsignedShort(int pos, int s)
Sets the unsignedshortat positionposin the Buffer to the values.The buffer will expand as necessary to accommodate any value written.
-
setUnsignedShortLE
Buffer setUnsignedShortLE(int pos, int s)
Sets the unsignedshortat positionposin the Buffer to the valuesin the Little Endian Byte Order.The buffer will expand as necessary to accommodate any value written.
-
setBuffer
Buffer setBuffer(int pos, Buffer b)
Sets the bytes at positionposin the Buffer to the bytes represented by theBuffer b.The buffer will expand as necessary to accommodate any value written.
-
setBuffer
Buffer setBuffer(int pos, Buffer b, int offset, int len)
Sets the bytes at positionposin the Buffer to the bytes represented by theBuffer bon the givenoffsetandlen.The buffer will expand as necessary to accommodate any value written.
-
setBytes
Buffer setBytes(int pos, ByteBuffer b)
Sets the bytes at positionposin the Buffer to the bytes represented by theByteBuffer b.The buffer will expand as necessary to accommodate any value written.
-
setBytes
Buffer setBytes(int pos, byte[] b)
Sets the bytes at positionposin the Buffer to the bytes represented by thebyte[] b.The buffer will expand as necessary to accommodate any value written.
-
setBytes
Buffer setBytes(int pos, byte[] b, int offset, int len)
Sets the given number of bytes at positionposin the Buffer to the bytes represented by thebyte[] b. The buffer will expand as necessary to accommodate any value written.
-
setString
Buffer setString(int pos, String str)
Sets the bytes at positionposin the Buffer to the value ofstrencoded in UTF-8.The buffer will expand as necessary to accommodate any value written.
-
setString
Buffer setString(int pos, String str, String enc)
Sets the bytes at positionposin the Buffer to the value ofstrencoded in encodingenc.The buffer will expand as necessary to accommodate any value written.
-
length
int length()
Returns the length of the buffer, measured in bytes. All positions are indexed from zero.
-
slice
Buffer slice()
Returns a slice of this buffer. Modifying the content of the returned buffer or this buffer affects each other's content while they maintain separate indexes and marks.
-
slice
Buffer slice(int start, int end)
Returns a slice of this buffer. Modifying the content of the returned buffer or this buffer affects each other's content while they maintain separate indexes and marks.
-
-