Top Description Methods
io.vertx.core.buffer

public Interface Buffer

extends ClusterSerializable, Shareable
Known Direct Implementers
io.vertx.core.buffer.impl.BufferImpl
Annotations
@VertxGen
Imports
io.netty.buffer.ByteBuf, io.vertx.codegen.annotations.Fluent, .GenIgnore, .VertxGen, io.vertx.core.buffer.impl.BufferImpl, io.vertx.core.json.Json, .JsonArray, .JsonObject, io.vertx.core.shareddata.ClusterSerializable, .Shareable, java.nio.ByteBuffer, java.nio.charset.Charset, java.util.Objects

References Deprecated

ClusterSerializable is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

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

Modifier and TypeMethod and Description
public Buffer
appendBuffer(Buffer buff)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Appends the specified Buffer to the end of this Buffer.

public Buffer
appendBuffer(Buffer buff, int offset, int len)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Appends the specified Buffer starting at the offset using len to the end of this Buffer.

public Buffer
appendByte(byte b)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Appends the specified byte to the end of the Buffer.

public Buffer
appendBytes(byte[] bytes)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Appends the specified byte[] to the end of the Buffer.

public Buffer
appendBytes(byte[] bytes, int offset, int len)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Appends the specified number of bytes from byte[] to the end of the Buffer, starting at the given offset.

public Buffer
appendDouble(double d)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Appends the specified double to the end of the Buffer.

public Buffer
appendFloat(float f)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Appends the specified float to the end of the Buffer.

public Buffer
appendInt(int i)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Appends the specified int to the end of the Buffer.

public Buffer
appendIntLE(int i)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Appends the specified int to the end of the Buffer in the Little Endian Byte Order.

public Buffer
appendLong(long l)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Appends the specified long to the end of the Buffer.

public Buffer
appendLongLE(long l)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Appends the specified long to the end of the Buffer in the Little Endian Byte Order.

public Buffer
appendMedium(int i)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Appends the specified 24bit int to the end of the Buffer.

public Buffer
appendMediumLE(int i)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Appends the specified 24bit int to the end of the Buffer in the Little Endian Byte Order.

public Buffer
appendShort(short s)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Appends the specified short to the end of the Buffer.The buffer will expand as necessary to accommodate any bytes written.

public Buffer
appendShortLE(short s)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Appends the specified short to the end of the Buffer in the Little Endian Byte Order.The buffer will expand as necessary to accommodate any bytes written.

public Buffer
appendString(String str, String enc)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Appends the specified String to the end of the Buffer with the encoding as specified by enc.

public Buffer
appendString(String str)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Appends the specified String str to the end of the Buffer with UTF-8 encoding.

public Buffer
appendUnsignedByte(short b)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Appends the specified unsigned byte to the end of the Buffer.

public Buffer
appendUnsignedInt(long i)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Appends the specified unsigned int to the end of the Buffer.

public Buffer
appendUnsignedIntLE(long i)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Appends the specified unsigned int to the end of the Buffer in the Little Endian Byte Order.

public Buffer
appendUnsignedShort(int s)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Appends the specified unsigned short to the end of the Buffer.The buffer will expand as necessary to accommodate any bytes written.

public Buffer
appendUnsignedShortLE(int s)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Appends the specified unsigned short to the end of the Buffer in the Little Endian Byte Order.The buffer will expand as necessary to accommodate any bytes written.

public static Buffer

Returns:

the buffer
buffer
()
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Create a new, empty buffer.

public static Buffer

Returns:

the buffer
buffer
(int
the hint, in bytes
initialSizeHint
)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Create a new buffer given the initial size hint.

public static Buffer

Returns:

the buffer
buffer
(String
the string
string
)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Create a new buffer from a string.

public static Buffer

Returns:

the buffer
buffer
(String
the string
string
,
String enc)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Create a new buffer from a string and using the specified encoding.

public static Buffer

Returns:

the buffer
buffer
(byte[]
the byte array
bytes
)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Create a new buffer from a byte[].

public static Buffer

Returns:

the buffer
buffer
(ByteBuf
the Netty ByteBuf
byteBuf
)
Deprecated removed from public API in Vert.x 5

Create a new buffer from a Netty ByteBuf.

public Buffer
copy()

Redeclares as abstract: io.vertx.core.shareddata.Shareable.copy.

References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Returns a copy of the entire Buffer.

public Buffer
getBuffer(int start, int end)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Returns a copy of a sub-sequence the Buffer as a io.vertx.core.buffer.Buffer starting at position start and ending at position end - 1

public byte
getByte(int pos)

Returns the byte at position pos in the Buffer.

public ByteBuf
getByteBuf()
Deprecated removed from public API in Vert.x 5

Returns the Buffer as a Netty ByteBuf.

public byte[]
getBytes()

Returns a copy of the entire Buffer as a byte[]

public byte[]
getBytes(int start, int end)

Returns a copy of a sub-sequence the Buffer as a byte[] starting at position start and ending at position end - 1

public Buffer
getBytes(byte[]
the destination byte array
dst
)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Transfers the content of the Buffer into a byte[].

public Buffer
getBytes(byte[]
the destination byte array
dst
,
int dstIndex)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Transfers the content of the Buffer into a byte[] at the specific destination.

public Buffer
getBytes(int start, int end, byte[]
the destination byte array
dst
)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Transfers the content of the Buffer starting at position start and ending at position end - 1 into a byte[].

public Buffer
getBytes(int start, int end, byte[]
the destination byte array
dst
,
int dstIndex)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Transfers the content of the Buffer starting at position start and ending at position end - 1 into a byte[] at the specific destination.

public double
getDouble(int pos)

Returns the double at position pos in the Buffer.

public float
getFloat(int pos)

Returns the float at position pos in the Buffer.

public int
getInt(int pos)

Returns the int at position pos in the Buffer.

public int
getIntLE(int pos)

Gets a 32-bit integer at the specified absolute index in this buffer with Little Endian Byte Order.

public long
getLong(int pos)

Returns the long at position pos in the Buffer.

public long
getLongLE(int pos)

Gets a 64-bit long integer at the specified absolute index in this buffer in Little Endian Byte Order.

public int
getMedium(int pos)

Gets a 24-bit medium integer at the specified absolute index in this buffer.

public int
getMediumLE(int pos)

Gets a 24-bit medium integer at the specified absolute index in this buffer in the Little Endian Byte Order.

public short
getShort(int pos)

Returns the short at position pos in the Buffer.

public short
getShortLE(int pos)

Gets a 16-bit short integer at the specified absolute index in this buffer in Little Endian Byte Order.

public String
getString(int start, int end, String enc)

Returns a copy of a sub-sequence the Buffer as a String starting at position start and ending at position end - 1 interpreted as a String in the specified encoding

public String
getString(int start, int end)

Returns a copy of a sub-sequence the Buffer as a String starting at position start and ending at position end - 1 interpreted as a String in UTF-8 encoding

public short
getUnsignedByte(int pos)

Returns the unsigned byte at position pos in the Buffer, as a short.

public long
getUnsignedInt(int pos)

Returns the unsigned int at position pos in the Buffer, as a long.

public long
getUnsignedIntLE(int pos)

Returns the unsigned int at position pos in the Buffer, as a long in Little Endian Byte Order.

public int
getUnsignedMedium(int pos)

Gets an unsigned 24-bit medium integer at the specified absolute index in this buffer.

public int
getUnsignedMediumLE(int pos)

Gets an unsigned 24-bit medium integer at the specified absolute index in this buffer in Little Endian Byte Order.

public int
getUnsignedShort(int pos)

Returns the unsigned short at position pos in the Buffer, as an int.

public int
getUnsignedShortLE(int pos)

Gets an unsigned 16-bit short integer at the specified absolute index in this buffer in Little Endian Byte Order.

public int
length()

Returns the length of the buffer, measured in bytes.

public Buffer
setBuffer(int pos, Buffer b)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Sets the bytes at position pos in the Buffer to the bytes represented by the Buffer b.

public Buffer
setBuffer(int pos, Buffer b, int offset, int len)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Sets the bytes at position pos in the Buffer to the bytes represented by the Buffer b on the given offset and len.

public Buffer
setByte(int pos, byte b)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Sets the byte at position pos in the Buffer to the value b.

public Buffer
setBytes(int pos, ByteBuffer b)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Sets the bytes at position pos in the Buffer to the bytes represented by the ByteBuffer b.

public Buffer
setBytes(int pos, byte[] b)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Sets the bytes at position pos in the Buffer to the bytes represented by the byte[] b.

public Buffer
setBytes(int pos, byte[] b, int offset, int len)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Sets the given number of bytes at position pos in the Buffer to the bytes represented by the byte[] b.

public Buffer
setDouble(int pos, double d)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Sets the double at position pos in the Buffer to the value d.

public Buffer
setFloat(int pos, float f)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Sets the float at position pos in the Buffer to the value f.

public Buffer
setInt(int pos, int i)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Sets the int at position pos in the Buffer to the value i.

public Buffer
setIntLE(int pos, int i)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Sets the int at position pos in the Buffer to the value i in the Little Endian Byte Order.

public Buffer
setLong(int pos, long l)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Sets the long at position pos in the Buffer to the value l.

public Buffer
setLongLE(int pos, long l)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Sets the long at position pos in the Buffer to the value l in the Little Endian Byte Order.

public Buffer
setMedium(int pos, int i)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Sets the 24bit int at position pos in the Buffer to the value i.

public Buffer
setMediumLE(int pos, int i)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Sets the 24bit int at position pos in the Buffer to the value i.

public Buffer
setShort(int pos, short s)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Sets the short at position pos in the Buffer to the value s.

public Buffer
setShortLE(int pos, short s)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Sets the short at position pos in the Buffer to the value s in the Little Endian Byte Order.

public Buffer
setString(int pos, String str)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Sets the bytes at position pos in the Buffer to the value of str encoded in UTF-8.

public Buffer
setString(int pos, String str, String enc)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Sets the bytes at position pos in the Buffer to the value of str encoded in encoding enc.

public Buffer
setUnsignedByte(int pos, short b)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Sets the unsigned byte at position pos in the Buffer to the value b.

public Buffer
setUnsignedInt(int pos, long i)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Sets the unsigned int at position pos in the Buffer to the value i.

public Buffer
setUnsignedIntLE(int pos, long i)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Sets the unsigned int at position pos in the Buffer to the value i in the Little Endian Byte Order.

public Buffer
setUnsignedShort(int pos, int s)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Sets the unsigned short at position pos in the Buffer to the value s.

public Buffer
setUnsignedShortLE(int pos, int s)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Sets the unsigned short at position pos in the Buffer to the value s in the Little Endian Byte Order.

public Buffer
slice()
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Returns a slice of this buffer.

public Buffer
slice(int start, int end)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Returns a slice of this buffer.

public default Object
toJson()
Deprecated instead use toJsonValue()

public JsonArray
toJsonArray()
References Deprecated JsonArray is deprecated or references (maybe indirectly) at least one deprecated element.

Returns a JsonArray representation of this buffer's content.

public JsonObject
toJsonObject()
References Deprecated JsonObject is deprecated or references (maybe indirectly) at least one deprecated element.

Returns a JsonObject representation of this buffer's content.

public default Object

Returns:

a Json value which can be a JsonArray, JsonObject, String, ... if the buffer contains an array, object, string, ...etc
toJsonValue
()

Returns a Json value representation of this buffer's content.

public String
toString()

Returns a String representation of the Buffer with the UTF-8 encoding

public String
toString(String enc)

Returns a String representation of the Buffer with the encoding specified by enc

public String
toString(Charset enc)

Returns a String representation of the Buffer with the encoding specified by enc

Inherited from io.vertx.core.shareddata.ClusterSerializable:
readFromBufferwriteToBuffer