Top Description Fields Constructors Methods
io.vertx.core.buffer.impl

public Class BufferImpl

extends Object
implements Buffer
Class Inheritance
All Implemented Interfaces
io.vertx.core.buffer.Buffer, io.vertx.core.shareddata.Shareable, io.vertx.core.shareddata.ClusterSerializable, io.vertx.core.shareddata.impl.ClusterSerializable
Imports
io.netty.buffer.ByteBuf, .Unpooled, io.netty.util.CharsetUtil, io.vertx.core.buffer.Buffer, io.vertx.core.impl.Arguments, io.vertx.core.json.JsonArray, .JsonObject, java.nio.ByteBuffer, java.nio.charset.Charset, .StandardCharsets, java.util.Objects

References Deprecated

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

See corresponding docs for further information.

This buffer implementation ignores the wrapped ByteBuf reader index, assuming that the first logical byte of this buffer maps to the first logical byte of the wrapped buffer. If a ByteBuf is wrapped and requires a reader index, then the buffer should be sliced or copied at the given index. This buffer implementation maps its length to the wrapped ByteBuf writer index.
Author
Tim Fox

Field Summary

Modifier and TypeField and Description
private ByteBuf

Constructor Summary

AccessConstructor and Description
public
pack-priv
BufferImpl(int initialSizeHint)

pack-priv
BufferImpl(byte[] bytes)

pack-priv
pack-priv
pack-priv
pack-priv

Method Summary

Modifier and TypeMethod and Description
private Buffer
append(String str, Charset charset)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

public Buffer
appendBuffer(Buffer buff)

Implements io.vertx.core.buffer.Buffer.appendBuffer.

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)

Implements io.vertx.core.buffer.Buffer.appendBuffer.

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)

Implements io.vertx.core.buffer.Buffer.appendByte.

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)

Implements io.vertx.core.buffer.Buffer.appendBytes.

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)

Implements io.vertx.core.buffer.Buffer.appendBytes.

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)

Implements io.vertx.core.buffer.Buffer.appendDouble.

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)

Implements io.vertx.core.buffer.Buffer.appendFloat.

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)

Implements io.vertx.core.buffer.Buffer.appendInt.

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)

Implements io.vertx.core.buffer.Buffer.appendIntLE.

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)

Implements io.vertx.core.buffer.Buffer.appendLong.

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)

Implements io.vertx.core.buffer.Buffer.appendLongLE.

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)

Implements io.vertx.core.buffer.Buffer.appendMedium.

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)

Implements io.vertx.core.buffer.Buffer.appendMediumLE.

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)

Implements io.vertx.core.buffer.Buffer.appendShort.

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)

Implements io.vertx.core.buffer.Buffer.appendShortLE.

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)

Implements io.vertx.core.buffer.Buffer.appendString.

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)

Implements io.vertx.core.buffer.Buffer.appendString.

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)

Implements io.vertx.core.buffer.Buffer.appendUnsignedByte.

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)

Implements io.vertx.core.buffer.Buffer.appendUnsignedInt.

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)

Implements io.vertx.core.buffer.Buffer.appendUnsignedIntLE.

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)

Implements io.vertx.core.buffer.Buffer.appendUnsignedShort.

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)

Implements io.vertx.core.buffer.Buffer.appendUnsignedShortLE.

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
buffer(int
the hint, in bytes
initialSizeHint
)

Hides io.vertx.core.buffer.Buffer.buffer.

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
buffer()

Hides io.vertx.core.buffer.Buffer.buffer.

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

Create a new, empty buffer.

public static Buffer
buffer(String
the string
str
)

Hides io.vertx.core.buffer.Buffer.buffer.

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

Create a new buffer from a string.

public static Buffer
buffer(String
the string
str
,
String enc)

Hides io.vertx.core.buffer.Buffer.buffer.

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
buffer(byte[]
the byte array
bytes
)

Hides io.vertx.core.buffer.Buffer.buffer.

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

Create a new buffer from a byte[].

public static Buffer
buffer(ByteBuf
the Netty ByteBuf
byteBuffer
)

Hides io.vertx.core.buffer.Buffer.buffer.

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

Create a new buffer from a Netty ByteBuf.

public ByteBuf

Returns:

the buffer as is
byteBuf
()

private void
checkUpperBound(int index, int size)

public Buffer
copy()

Implements io.vertx.core.buffer.Buffer.copy.

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

Returns a copy of the entire Buffer.

private void
ensureExpandableBy(int amount)

Make sure that the underlying buffer can be expanded by amount bytes.

private void
ensureLength(int newLength)

Ensure buffer length is at least the provided newLength.

public boolean
equals(Object
the reference object with which to compare.
o
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public Buffer
getBuffer(int start, int end)

Implements io.vertx.core.buffer.Buffer.getBuffer.

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)

Implements io.vertx.core.buffer.Buffer.getByte.

Returns the byte at position pos in the Buffer.

public ByteBuf
getByteBuf()

Implements io.vertx.core.buffer.Buffer.getByteBuf.

Returns the Buffer as a Netty ByteBuf.

public byte[]
getBytes()

Implements io.vertx.core.buffer.Buffer.getBytes.

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

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

Implements io.vertx.core.buffer.Buffer.getBytes.

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
)

Implements io.vertx.core.buffer.Buffer.getBytes.

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)

Implements io.vertx.core.buffer.Buffer.getBytes.

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
)

Implements io.vertx.core.buffer.Buffer.getBytes.

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)

Implements io.vertx.core.buffer.Buffer.getBytes.

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)

Implements io.vertx.core.buffer.Buffer.getDouble.

Returns the double at position pos in the Buffer.

public float
getFloat(int pos)

Implements io.vertx.core.buffer.Buffer.getFloat.

Returns the float at position pos in the Buffer.

public int
getInt(int pos)

Implements io.vertx.core.buffer.Buffer.getInt.

Returns the int at position pos in the Buffer.

public int
getIntLE(int pos)

Implements io.vertx.core.buffer.Buffer.getIntLE.

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

public long
getLong(int pos)

Implements io.vertx.core.buffer.Buffer.getLong.

Returns the long at position pos in the Buffer.

public long
getLongLE(int pos)

Implements io.vertx.core.buffer.Buffer.getLongLE.

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

public int
getMedium(int pos)

Implements io.vertx.core.buffer.Buffer.getMedium.

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

public int
getMediumLE(int pos)

Implements io.vertx.core.buffer.Buffer.getMediumLE.

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)

Implements io.vertx.core.buffer.Buffer.getShort.

Returns the short at position pos in the Buffer.

public short
getShortLE(int pos)

Implements io.vertx.core.buffer.Buffer.getShortLE.

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)

Implements io.vertx.core.buffer.Buffer.getString.

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)

Implements io.vertx.core.buffer.Buffer.getString.

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)

Implements io.vertx.core.buffer.Buffer.getUnsignedByte.

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

public long
getUnsignedInt(int pos)

Implements io.vertx.core.buffer.Buffer.getUnsignedInt.

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

public long
getUnsignedIntLE(int pos)

Implements io.vertx.core.buffer.Buffer.getUnsignedIntLE.

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

public int
getUnsignedMedium(int pos)

Implements io.vertx.core.buffer.Buffer.getUnsignedMedium.

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

public int
getUnsignedMediumLE(int pos)

Implements io.vertx.core.buffer.Buffer.getUnsignedMediumLE.

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)

Implements io.vertx.core.buffer.Buffer.getUnsignedShort.

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

public int
getUnsignedShortLE(int pos)

Implements io.vertx.core.buffer.Buffer.getUnsignedShortLE.

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

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public int
length()

Implements io.vertx.core.buffer.Buffer.length.

Returns the length of the buffer, measured in bytes.

public int
readFromBuffer(int
the position where to start reading the buffer
pos
,
Buffer
the Buffer where the serialized bytes must be read from
buffer
)

Implements io.vertx.core.shareddata.ClusterSerializable.readFromBuffer.

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

Method invoked when deserializing bytes to this instance.

public Buffer
setBuffer(int pos, Buffer buff)

Implements io.vertx.core.buffer.Buffer.setBuffer.

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 buffer, int offset, int len)

Implements io.vertx.core.buffer.Buffer.setBuffer.

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)

Implements io.vertx.core.buffer.Buffer.setByte.

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 BufferImpl
setBytes(int pos, ByteBuffer b)

Implements io.vertx.core.buffer.Buffer.setBytes.

References Deprecated BufferImpl 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)

Implements io.vertx.core.buffer.Buffer.setBytes.

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)

Implements io.vertx.core.buffer.Buffer.setBytes.

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.

private Buffer
setBytes(int pos, String str, Charset charset)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

public Buffer
setDouble(int pos, double d)

Implements io.vertx.core.buffer.Buffer.setDouble.

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)

Implements io.vertx.core.buffer.Buffer.setFloat.

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.

private void
setFullMaxCapacity(int capacity)

public Buffer
setInt(int pos, int i)

Implements io.vertx.core.buffer.Buffer.setInt.

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)

Implements io.vertx.core.buffer.Buffer.setIntLE.

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)

Implements io.vertx.core.buffer.Buffer.setLong.

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)

Implements io.vertx.core.buffer.Buffer.setLongLE.

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)

Implements io.vertx.core.buffer.Buffer.setMedium.

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)

Implements io.vertx.core.buffer.Buffer.setMediumLE.

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)

Implements io.vertx.core.buffer.Buffer.setShort.

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)

Implements io.vertx.core.buffer.Buffer.setShortLE.

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)

Implements io.vertx.core.buffer.Buffer.setString.

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)

Implements io.vertx.core.buffer.Buffer.setString.

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)

Implements io.vertx.core.buffer.Buffer.setUnsignedByte.

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)

Implements io.vertx.core.buffer.Buffer.setUnsignedInt.

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)

Implements io.vertx.core.buffer.Buffer.setUnsignedIntLE.

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)

Implements io.vertx.core.buffer.Buffer.setUnsignedShort.

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)

Implements io.vertx.core.buffer.Buffer.setUnsignedShortLE.

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()

Implements io.vertx.core.buffer.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)

Implements io.vertx.core.buffer.Buffer.slice.

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

Returns a slice of this buffer.

public JsonArray
toJsonArray()

Implements io.vertx.core.buffer.Buffer.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()

Implements io.vertx.core.buffer.Buffer.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 String
toString()

Overrides java.lang.Object.toString.

Implements io.vertx.core.buffer.Buffer.toString.

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

public String
toString(String enc)

Implements io.vertx.core.buffer.Buffer.toString.

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

public String
toString(Charset enc)

Implements io.vertx.core.buffer.Buffer.toString.

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

public void
writeToBuffer(Buffer
the Buffer where the serialized bytes must be written to
buff
)

Implements io.vertx.core.shareddata.ClusterSerializable.writeToBuffer.

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

Method invoked when serializing this instance.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait