Appends the specified T
starting at the offset
using len
to the end of this Buffer.
Appends the specified T
starting at the offset
using len
to the end of this Buffer. The buffer will
expand as necessary to accommodate any bytes written.
Returns a reference to this
so multiple operations can be appended together.
if len
is less than 0
if the specified offset
is less than 0
,
if offset
+ len
is greater than the buffer's capacity
Appends the specified T
to the end of the Buffer.
Appends the specified T
to the end of the Buffer. The buffer will
expand as necessary to accommodate any bytes written.
Returns a reference to this
so multiple operations can be appended together.
The value to append to the Buffer.
A reference to this
so multiple operations can be appended together.
Returns a copy of the entire Buffer.
Returns a copy of a sub-sequence the Buffer as a org.vertx.scala.core.buffer.Buffer starting
at position start
and ending at position end - 1
Returns the byte
at position pos
in the Buffer.
Returns the byte
at position pos
in the Buffer.
if the specified pos
is less than 0
or pos + 1
is greater than the length of the Buffer.
Returns the Buffer as a Netty ByteBuf
.
Returns the Buffer as a Netty ByteBuf
.
This method is meant for internal use only.
Returns a copy of a sub-sequence the Buffer as a byte[]
starting at position start
and ending at position end - 1
Returns a copy of the entire Buffer as a byte[]
Returns the double
at position pos
in the Buffer.
Returns the double
at position pos
in the Buffer.
if the specified pos
is less than 0
or pos + 8
is greater than the length of the Buffer.
Returns the float
at position pos
in the Buffer.
Returns the float
at position pos
in the Buffer.
if the specified pos
is less than 0
or pos + 4
is greater than the length of the Buffer.
Returns the int
at position pos
in the Buffer.
Returns the int
at position pos
in the Buffer.
if the specified pos
is less than 0
or pos + 4
is greater than the length of the Buffer.
Returns the long
at position pos
in the Buffer.
Returns the long
at position pos
in the Buffer.
if the specified pos
is less than 0
or pos + 8
is greater than the length of the Buffer.
Returns the short
at position pos
in the Buffer.
Returns the short
at position pos
in the Buffer.
if the specified pos
is less than 0
or pos + 2
is greater than the length of the Buffer.
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
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
Returns the length of the buffer, measured in bytes.
Returns the length of the buffer, measured in bytes. All positions are indexed from zero.
Sets the bytes at position pos
in the Buffer to the bytes represented by the Buffer b
on the given offset
and len
.
Sets the bytes at position pos
in the Buffer to the bytes represented by the Buffer b
on the given offset
and len
.
The buffer will expand as necessary to accommodate any value written.
Sets the bytes at position pos
in the Buffer to the bytes represented by the Buffer b
.
Sets the bytes at position pos
in the Buffer to the bytes represented by the Buffer b
.
The buffer will expand as necessary to accommodate any value written.
Sets the byte
at position pos
in the Buffer to the value b
.
Sets the byte
at position pos
in the Buffer to the value b
.
The buffer will expand as necessary to accommodate any value written.
Sets the given number of bytes at position pos
in the Buffer to
the bytes represented by the byte[] b
.
Sets the given number of bytes at position pos
in the Buffer to
the bytes represented by the byte[] b
.
The buffer will expand as necessary to accommodate any value written.
if len
is less than 0
if the specified offset
is less than 0
,
if offset
+ len
is greater than the buffer's capacity, or
if pos
+ length
is greater than b.length
Sets the bytes at position pos
in the Buffer to the bytes represented by the byte[] b
.
Sets the bytes at position pos
in the Buffer to the bytes represented by the byte[] b
.
The buffer will expand as necessary to accommodate any value written.
Sets the bytes at position pos
in the Buffer to the bytes represented by the ByteBuffer b
.
Sets the bytes at position pos
in the Buffer to the bytes represented by the ByteBuffer b
.
The buffer will expand as necessary to accommodate any value written.
Sets the double
at position pos
in the Buffer to the value d
.
Sets the double
at position pos
in the Buffer to the value d
.
The buffer will expand as necessary to accommodate any value written.
Sets the float
at position pos
in the Buffer to the value f
.
Sets the float
at position pos
in the Buffer to the value f
.
The buffer will expand as necessary to accommodate any value written.
Sets the int
at position pos
in the Buffer to the value i
.
Sets the int
at position pos
in the Buffer to the value i
.
The buffer will expand as necessary to accommodate any value written.
Sets the long
at position pos
in the Buffer to the value l
.
Sets the long
at position pos
in the Buffer to the value l
.
The buffer will expand as necessary to accommodate any value written.
Sets the short
at position pos
in the Buffer to the value s
.
Sets the short
at position pos
in the Buffer to the value s
.
The buffer will expand as necessary to accommodate any value written.
Sets the bytes at position pos
in the Buffer to the value of str
encoded in encoding enc
.
Sets the bytes at position pos
in the Buffer to the value of str
encoded in encoding enc
.
The buffer will expand as necessary to accommodate any value written.
Sets the bytes at position pos
in the Buffer to the value of str
encoded in UTF-8.
Sets the bytes at position pos
in the Buffer to the value of str
encoded in UTF-8.
The buffer will expand as necessary to accommodate any value written.
Returns a String
representation of the Buffer with the encoding specified by enc
Returns a String
representation of the Buffer with the encoding specified by enc
The encoding to use to compute the String.
A string representation of the Buffer.
Returns a String
representation of the Buffer assuming it contains a
String
encoding in UTF-8.
Returns a String
representation of the Buffer assuming it contains a
String
encoding in UTF-8.
A string representation of the Buffer.
Helper method wrapping invocations and returning the Scala type, once again to help provide fluent return types
Helper method wrapping invocations and returning the Scala type, once again to help provide fluent return types
A Buffer represents a sequence of zero or more bytes that can be written to or read from, and which expands as necessary to accommodate any bytes written to it.
There are two ways to write data to a Buffer: The first method involves methods that take the form
setXXX
. These methods write data into the buffer starting at the specified position. The position does not have to be inside data that has already been written to the buffer; the buffer will automatically expand to encompass the position plus any data that needs to be written. All positions are measured in bytes and start with zero.The second method involves methods that take the form
appendXXX
; these methods append data at the end of the buffer.Methods exist to both
set
andappend
all primitive types, java.lang.String}, java.nio.ByteBuffer and other instances of Buffer.Data can be read from a buffer by invoking methods which take the form
getXXX
. These methods take a parameter representing the position in the Buffer from where to read data.Once a buffer has been written to a socket or other write stream, the same buffer instance can't be written again to another WriteStream.
Instances of this class are not thread-safe.