Package io.servicetalk.buffer.api
Interface CompositeBuffer
- All Superinterfaces:
Buffer
A virtual
Buffer
which shows multiple buffers as a single merged buffer.-
Method Summary
Modifier and TypeMethodDescriptiondefault CompositeBuffer
Add the givenBuffer
to this buffer and increment the writerIndex.Add the givenBuffer
to this buffer.capacity
(int newCapacity) Sets the capacity of this buffer.clear()
Sets thereaderIndex
andwriterIndex
of this buffer to0
.Consolidate the composedBuffer
s.consolidate
(int index, int count) Consolidate the composedBuffer
s.Discard allBuffer
s which have been read.getBytes
(int index, byte[] dst) Transfers this buffer's data to the specified destination starting at the specified absoluteindex
.getBytes
(int index, byte[] dst, int dstIndex, int length) Transfers this buffer's data to the specified destination starting at the specified absoluteindex
.Transfers this buffer's data to the specified destination starting at the specified absoluteindex
until the destination becomes non-writable.Transfers this buffer's data to the specified destination starting at the specified absoluteindex
.Transfers this buffer's data to the specified destination starting at the specified absoluteindex
.getBytes
(int index, ByteBuffer dst) Transfers this buffer's data to the specified destination starting at the specified absoluteindex
until the destination's position reaches its limit.readerIndex
(int readerIndex) Sets thereaderIndex
of this buffer.setBoolean
(int index, boolean value) Sets the specified boolean at the specified absoluteindex
in this buffer.setByte
(int index, int value) Sets the specified byte at the specified absoluteindex
in this buffer.setBytes
(int index, byte[] src) Transfers the specified source array's data to this buffer starting at the specified absoluteindex
.setBytes
(int index, byte[] src, int srcIndex, int length) Transfers the specified source array's data to this buffer starting at the specified absoluteindex
.Transfers the specified source buffer's data to this buffer starting at the specified absoluteindex
until the source buffer becomes unreadable.Transfers the specified source buffer's data to this buffer starting at the specified absoluteindex
.Transfers the specified source buffer's data to this buffer starting at the specified absoluteindex
.setBytes
(int index, ByteBuffer src) Transfers the specified source buffer's data to this buffer starting at the specified absoluteindex
until the source buffer's position reaches its limit.setChar
(int index, int value) Sets the specified 2-byte UTF-16 character at the specified absoluteindex
in this buffer.setDouble
(int index, double value) Sets the specified 64-bit floating-point number at the specified absoluteindex
in this buffer.setFloat
(int index, float value) Sets the specified 32-bit floating-point number at the specified absoluteindex
in this buffer.setInt
(int index, int value) Sets the specified 32-bit integer at the specified absoluteindex
in this buffer.setIntLE
(int index, int value) Sets the specified 32-bit integer at the specified absoluteindex
in this buffer with Little Endian byte order .setLong
(int index, long value) Sets the specified 64-bit long integer at the specified absoluteindex
in this buffer.setLongLE
(int index, long value) Sets the specified 64-bit long integer at the specified absoluteindex
in this buffer in Little Endian Byte Order.setMedium
(int index, int value) Sets the specified 24-bit medium integer at the specified absoluteindex
in this buffer.setMediumLE
(int index, int value) Sets the specified 24-bit medium integer at the specified absoluteindex
in this buffer in the Little Endian Byte Order.setShort
(int index, int value) Sets the specified 16-bit short integer at the specified absoluteindex
in this buffer.setShortLE
(int index, int value) Sets the specified 16-bit short integer at the specified absoluteindex
in this buffer with the Little Endian Byte Order.skipBytes
(int length) Increases the currentreaderIndex
by the specifiedlength
in this buffer.writeAscii
(CharSequence seq) Encode aCharSequence
in ASCII and write it to this buffer starting atwriterIndex
and increases thewriterIndex
by the number of the transferred bytes.writeBoolean
(boolean value) Sets the specified boolean at the currentwriterIndex
and increases thewriterIndex
by1
in this buffer.writeByte
(int value) Sets the specified byte at the currentwriterIndex
and increases thewriterIndex
by1
in this buffer.writeBytes
(byte[] src) Transfers the specified source array's data to this buffer starting at the currentwriterIndex
and increases thewriterIndex
by the number of the transferred bytes (=src.length
).writeBytes
(byte[] src, int srcIndex, int length) Transfers the specified source array's data to this buffer starting at the currentwriterIndex
and increases thewriterIndex
by the number of the transferred bytes (=length
).writeBytes
(Buffer src) Transfers the specified source buffer's data to this buffer starting at the currentwriterIndex
until the source buffer becomes unreadable, and increases thewriterIndex
by the number of the transferred bytes.writeBytes
(Buffer src, int length) Transfers the specified source buffer's data to this buffer starting at the currentwriterIndex
and increases thewriterIndex
by the number of the transferred bytes (=length
).writeBytes
(Buffer src, int srcIndex, int length) Transfers the specified source buffer's data to this buffer starting at the currentwriterIndex
and increases thewriterIndex
by the number of the transferred bytes (=length
).writeBytes
(ByteBuffer src) Transfers the specified source buffer's data to this buffer starting at the currentwriterIndex
until the source buffer's position reaches its limit, and increases thewriterIndex
by the number of the transferred bytes.writeChar
(int value) Sets the specified 2-byte UTF-16 character at the currentwriterIndex
and increases thewriterIndex
by2
in this buffer.writeDouble
(double value) Sets the specified 64-bit floating point number at the currentwriterIndex
and increases thewriterIndex
by8
in this buffer.writeFloat
(float value) Sets the specified 32-bit floating point number at the currentwriterIndex
and increases thewriterIndex
by4
in this buffer.writeInt
(int value) Sets the specified 32-bit integer at the currentwriterIndex
and increases thewriterIndex
by4
in this buffer.writeIntLE
(int value) Sets the specified 32-bit integer at the currentwriterIndex
in the Little Endian Byte Order and increases thewriterIndex
by4
in this buffer.writeLong
(long value) Sets the specified 64-bit long integer at the currentwriterIndex
and increases thewriterIndex
by8
in this buffer.writeLongLE
(long value) Sets the specified 64-bit long integer at the currentwriterIndex
in the Little Endian Byte Order and increases thewriterIndex
by8
in this buffer.writeMedium
(int value) Sets the specified 24-bit medium integer at the currentwriterIndex
and increases thewriterIndex
by3
in this buffer.writeMediumLE
(int value) Sets the specified 24-bit medium integer at the currentwriterIndex
in the Little Endian Byte Order and increases thewriterIndex
by3
in this buffer.writerIndex
(int writerIndex) Sets thewriterIndex
of this buffer.writeShort
(int value) Sets the specified 16-bit short integer at the currentwriterIndex
and increases thewriterIndex
by2
in this buffer.writeShortLE
(int value) Sets the specified 16-bit short integer in the Little Endian Byte Order at the currentwriterIndex
and increases thewriterIndex
by2
in this buffer.writeUtf8
(CharSequence seq) Encode aCharSequence
in UTF-8 and write it to this buffer starting atwriterIndex
and increases thewriterIndex
by the number of the transferred bytes.Methods inherited from interface io.servicetalk.buffer.api.Buffer
array, arrayOffset, asReadOnly, bytesBefore, bytesBefore, bytesBefore, capacity, copy, copy, duplicate, ensureWritable, ensureWritable, equals, forEachByte, forEachByte, forEachByteDesc, forEachByteDesc, getBoolean, getByte, getChar, getDouble, getFloat, getInt, getIntLE, getLong, getLongLE, getMedium, getMediumLE, getShort, getShortLE, getUnsignedByte, getUnsignedInt, getUnsignedIntLE, getUnsignedMedium, getUnsignedMediumLE, getUnsignedShort, getUnsignedShortLE, hasArray, hashCode, indexOf, isDirect, isReadOnly, maxCapacity, maxWritableBytes, nioBufferCount, readableBytes, readBoolean, readByte, readBytes, readBytes, readBytes, readBytes, readBytes, readBytes, readBytes, readChar, readDouble, readerIndex, readFloat, readInt, readIntLE, readLong, readLongLE, readMedium, readMediumLE, readShort, readShortLE, readSlice, readUnsignedByte, readUnsignedInt, readUnsignedIntLE, readUnsignedMedium, readUnsignedMediumLE, readUnsignedShort, readUnsignedShortLE, setBytes, setBytesUntilEndStream, slice, slice, toNioBuffer, toNioBuffer, toNioBuffers, toNioBuffers, toString, toString, toString, tryEnsureWritable, writableBytes, writeBytes, writeBytesUntilEndStream, writeCharSequence, writerIndex, writeUtf8
-
Method Details
-
addBuffer
Add the givenBuffer
to this buffer and increment the writerIndex.- Parameters:
buffer
- the buffer to add.- Returns:
- self.
-
addBuffer
Add the givenBuffer
to this buffer.- Parameters:
buffer
- the buffer to add.incrementWriterIndex
- iftrue
the writerIndex will be increment by the number of readableBytes of the given buffer.- Returns:
- self.
-
consolidate
CompositeBuffer consolidate()Consolidate the composedBuffer
s.- Returns:
- self.
-
consolidate
Consolidate the composedBuffer
s.- Parameters:
index
- the index on which to start to compose.count
- the number of contained buffers to compose.- Returns:
- self.
-
discardSomeReadBytes
CompositeBuffer discardSomeReadBytes()Discard allBuffer
s which have been read.- Returns:
- self.
-
capacity
Description copied from interface:Buffer
Sets the capacity of this buffer. If thenewCapacity
is less than the current capacity, the content of this buffer is truncated. If thenewCapacity
is greater than the current capacity, the buffer is appended with unspecified data whose length is(newCapacity - currentCapacity)
. -
readerIndex
Description copied from interface:Buffer
Sets thereaderIndex
of this buffer.- Specified by:
readerIndex
in interfaceBuffer
- Parameters:
readerIndex
- the new readerIndex of this buffer.- Returns:
- itself.
-
writerIndex
Description copied from interface:Buffer
Sets thewriterIndex
of this buffer.- Specified by:
writerIndex
in interfaceBuffer
- Parameters:
writerIndex
- the new writerIndex of this buffer.- Returns:
- itself.
-
clear
CompositeBuffer clear()Description copied from interface:Buffer
Sets thereaderIndex
andwriterIndex
of this buffer to0
.Please note that the behavior of this method is different from that of NIO buffer, which sets the
limit
to thecapacity
of the buffer. -
getBytes
Description copied from interface:Buffer
Transfers this buffer's data to the specified destination starting at the specified absoluteindex
until the destination becomes non-writable. This method is basically same withBuffer.getBytes(int, Buffer, int, int)
, except that this method increases thewriterIndex
of the destination by the number of the transferred bytes whileBuffer.getBytes(int, Buffer, int, int)
does not. This method does not modifyreaderIndex
orwriterIndex
of the source buffer (i.e.this
). -
getBytes
Description copied from interface:Buffer
Transfers this buffer's data to the specified destination starting at the specified absoluteindex
. This method is basically same withBuffer.getBytes(int, Buffer, int, int)
, except that this method increases thewriterIndex
of the destination by the number of the transferred bytes whileBuffer.getBytes(int, Buffer, int, int)
does not. This method does not modifyreaderIndex
orwriterIndex
of the source buffer (i.e.this
). -
getBytes
Description copied from interface:Buffer
Transfers this buffer's data to the specified destination starting at the specified absoluteindex
. This method does not modifyreaderIndex
orwriterIndex
of both the source (i.e.this
) and the destination. -
getBytes
Description copied from interface:Buffer
Transfers this buffer's data to the specified destination starting at the specified absoluteindex
. This method does not modifyreaderIndex
orwriterIndex
of this buffer -
getBytes
Description copied from interface:Buffer
Transfers this buffer's data to the specified destination starting at the specified absoluteindex
. This method does not modifyreaderIndex
orwriterIndex
of this buffer. -
getBytes
Description copied from interface:Buffer
Transfers this buffer's data to the specified destination starting at the specified absoluteindex
until the destination's position reaches its limit. This method does not modifyreaderIndex
orwriterIndex
of this buffer while the destination'sposition
will be increased. -
setBoolean
Description copied from interface:Buffer
Sets the specified boolean at the specified absoluteindex
in this buffer. This method does not modifyreaderIndex
orwriterIndex
of this buffer.- Specified by:
setBoolean
in interfaceBuffer
- Parameters:
index
- absolute (@code index) in this buffer.value
- the value.- Returns:
- itself.
-
setByte
Description copied from interface:Buffer
Sets the specified byte at the specified absoluteindex
in this buffer. The 24 high-order bits of the specified value are ignored. This method does not modifyreaderIndex
orwriterIndex
of this buffer. -
setShort
Description copied from interface:Buffer
Sets the specified 16-bit short integer at the specified absoluteindex
in this buffer. The 16 high-order bits of the specified value are ignored. This method does not modifyreaderIndex
orwriterIndex
of this buffer. -
setShortLE
Description copied from interface:Buffer
Sets the specified 16-bit short integer at the specified absoluteindex
in this buffer with the Little Endian Byte Order. The 16 high-order bits of the specified value are ignored. This method does not modifyreaderIndex
orwriterIndex
of this buffer.- Specified by:
setShortLE
in interfaceBuffer
- Parameters:
index
- absolute (@code index) in this buffer.value
- the value.- Returns:
- itself.
-
setMedium
Description copied from interface:Buffer
Sets the specified 24-bit medium integer at the specified absoluteindex
in this buffer. Please note that the most significant byte is ignored in the specified value. This method does not modifyreaderIndex
orwriterIndex
of this buffer. -
setMediumLE
Description copied from interface:Buffer
Sets the specified 24-bit medium integer at the specified absoluteindex
in this buffer in the Little Endian Byte Order. Please note that the most significant byte is ignored in the specified value. This method does not modifyreaderIndex
orwriterIndex
of this buffer.- Specified by:
setMediumLE
in interfaceBuffer
- Parameters:
index
- absolute (@code index) in this buffer.value
- the value.- Returns:
- itself.
-
setInt
Description copied from interface:Buffer
Sets the specified 32-bit integer at the specified absoluteindex
in this buffer. This method does not modifyreaderIndex
orwriterIndex
of this buffer. -
setIntLE
Description copied from interface:Buffer
Sets the specified 32-bit integer at the specified absoluteindex
in this buffer with Little Endian byte order . This method does not modifyreaderIndex
orwriterIndex
of this buffer. -
setLong
Description copied from interface:Buffer
Sets the specified 64-bit long integer at the specified absoluteindex
in this buffer. This method does not modifyreaderIndex
orwriterIndex
of this buffer. -
setLongLE
Description copied from interface:Buffer
Sets the specified 64-bit long integer at the specified absoluteindex
in this buffer in Little Endian Byte Order. This method does not modifyreaderIndex
orwriterIndex
of this buffer. -
setChar
Description copied from interface:Buffer
Sets the specified 2-byte UTF-16 character at the specified absoluteindex
in this buffer. The 16 high-order bits of the specified value are ignored. This method does not modifyreaderIndex
orwriterIndex
of this buffer. -
setFloat
Description copied from interface:Buffer
Sets the specified 32-bit floating-point number at the specified absoluteindex
in this buffer. This method does not modifyreaderIndex
orwriterIndex
of this buffer. -
setDouble
Description copied from interface:Buffer
Sets the specified 64-bit floating-point number at the specified absoluteindex
in this buffer. This method does not modifyreaderIndex
orwriterIndex
of this buffer. -
setBytes
Description copied from interface:Buffer
Transfers the specified source buffer's data to this buffer starting at the specified absoluteindex
until the source buffer becomes unreadable. This method is basically same withBuffer.setBytes(int, Buffer, int, int)
, except that this method increases thereaderIndex
of the source buffer by the number of the transferred bytes whileBuffer.setBytes(int, Buffer, int, int)
does not. This method does not modifyreaderIndex
orwriterIndex
of the source buffer (i.e.this
). -
setBytes
Description copied from interface:Buffer
Transfers the specified source buffer's data to this buffer starting at the specified absoluteindex
. This method is basically same withBuffer.setBytes(int, Buffer, int, int)
, except that this method increases thereaderIndex
of the source buffer by the number of the transferred bytes whileBuffer.setBytes(int, Buffer, int, int)
does not. This method does not modifyreaderIndex
orwriterIndex
of the source buffer (i.e.this
). -
setBytes
Description copied from interface:Buffer
Transfers the specified source buffer's data to this buffer starting at the specified absoluteindex
. This method does not modifyreaderIndex
orwriterIndex
of both the source (i.e.this
) and the destination. -
setBytes
Description copied from interface:Buffer
Transfers the specified source array's data to this buffer starting at the specified absoluteindex
. This method does not modifyreaderIndex
orwriterIndex
of this buffer. -
setBytes
Description copied from interface:Buffer
Transfers the specified source array's data to this buffer starting at the specified absoluteindex
. This method does not modifyreaderIndex
orwriterIndex
of this buffer. -
setBytes
Description copied from interface:Buffer
Transfers the specified source buffer's data to this buffer starting at the specified absoluteindex
until the source buffer's position reaches its limit. This method does not modifyreaderIndex
orwriterIndex
of this buffer. -
skipBytes
Description copied from interface:Buffer
Increases the currentreaderIndex
by the specifiedlength
in this buffer. -
writeBoolean
Description copied from interface:Buffer
Sets the specified boolean at the currentwriterIndex
and increases thewriterIndex
by1
in this buffer. Ifthis.writableBytes
is less than1
,Buffer.ensureWritable(int)
will be called in an attempt to expand capacity to accommodate.- Specified by:
writeBoolean
in interfaceBuffer
- Parameters:
value
- the value to write.- Returns:
- self.
-
writeByte
Description copied from interface:Buffer
Sets the specified byte at the currentwriterIndex
and increases thewriterIndex
by1
in this buffer. The 24 high-order bits of the specified value are ignored. Ifthis.writableBytes
is less than1
,Buffer.ensureWritable(int)
will be called in an attempt to expand capacity to accommodate. -
writeShort
Description copied from interface:Buffer
Sets the specified 16-bit short integer at the currentwriterIndex
and increases thewriterIndex
by2
in this buffer. The 16 high-order bits of the specified value are ignored. Ifthis.writableBytes
is less than2
,Buffer.ensureWritable(int)
will be called in an attempt to expand capacity to accommodate.- Specified by:
writeShort
in interfaceBuffer
- Parameters:
value
- the value to write.- Returns:
- self.
-
writeShortLE
Description copied from interface:Buffer
Sets the specified 16-bit short integer in the Little Endian Byte Order at the currentwriterIndex
and increases thewriterIndex
by2
in this buffer. The 16 high-order bits of the specified value are ignored. Ifthis.writableBytes
is less than2
,Buffer.ensureWritable(int)
will be called in an attempt to expand capacity to accommodate.- Specified by:
writeShortLE
in interfaceBuffer
- Parameters:
value
- the value to write.- Returns:
- self.
-
writeMedium
Description copied from interface:Buffer
Sets the specified 24-bit medium integer at the currentwriterIndex
and increases thewriterIndex
by3
in this buffer. Ifthis.writableBytes
is less than3
,Buffer.ensureWritable(int)
will be called in an attempt to expand capacity to accommodate.- Specified by:
writeMedium
in interfaceBuffer
- Parameters:
value
- the value to write.- Returns:
- self.
-
writeMediumLE
Description copied from interface:Buffer
Sets the specified 24-bit medium integer at the currentwriterIndex
in the Little Endian Byte Order and increases thewriterIndex
by3
in this buffer. Ifthis.writableBytes
is less than3
,Buffer.ensureWritable(int)
will be called in an attempt to expand capacity to accommodate.- Specified by:
writeMediumLE
in interfaceBuffer
- Parameters:
value
- the value to write.- Returns:
- self.
-
writeInt
Description copied from interface:Buffer
Sets the specified 32-bit integer at the currentwriterIndex
and increases thewriterIndex
by4
in this buffer. Ifthis.writableBytes
is less than4
,Buffer.ensureWritable(int)
will be called in an attempt to expand capacity to accommodate. -
writeIntLE
Description copied from interface:Buffer
Sets the specified 32-bit integer at the currentwriterIndex
in the Little Endian Byte Order and increases thewriterIndex
by4
in this buffer. Ifthis.writableBytes
is less than4
,Buffer.ensureWritable(int)
will be called in an attempt to expand capacity to accommodate.- Specified by:
writeIntLE
in interfaceBuffer
- Parameters:
value
- the value to write.- Returns:
- self.
-
writeLong
Description copied from interface:Buffer
Sets the specified 64-bit long integer at the currentwriterIndex
and increases thewriterIndex
by8
in this buffer. Ifthis.writableBytes
is less than8
,Buffer.ensureWritable(int)
will be called in an attempt to expand capacity to accommodate. -
writeLongLE
Description copied from interface:Buffer
Sets the specified 64-bit long integer at the currentwriterIndex
in the Little Endian Byte Order and increases thewriterIndex
by8
in this buffer. Ifthis.writableBytes
is less than8
,Buffer.ensureWritable(int)
will be called in an attempt to expand capacity to accommodate.- Specified by:
writeLongLE
in interfaceBuffer
- Parameters:
value
- the value to write.- Returns:
- self.
-
writeChar
Description copied from interface:Buffer
Sets the specified 2-byte UTF-16 character at the currentwriterIndex
and increases thewriterIndex
by2
in this buffer. The 16 high-order bits of the specified value are ignored. Ifthis.writableBytes
is less than2
,Buffer.ensureWritable(int)
will be called in an attempt to expand capacity to accommodate. -
writeFloat
Description copied from interface:Buffer
Sets the specified 32-bit floating point number at the currentwriterIndex
and increases thewriterIndex
by4
in this buffer. Ifthis.writableBytes
is less than4
,Buffer.ensureWritable(int)
will be called in an attempt to expand capacity to accommodate.- Specified by:
writeFloat
in interfaceBuffer
- Parameters:
value
- the value to write.- Returns:
- self.
-
writeDouble
Description copied from interface:Buffer
Sets the specified 64-bit floating point number at the currentwriterIndex
and increases thewriterIndex
by8
in this buffer. Ifthis.writableBytes
is less than8
,Buffer.ensureWritable(int)
will be called in an attempt to expand capacity to accommodate.- Specified by:
writeDouble
in interfaceBuffer
- Parameters:
value
- the value to write.- Returns:
- self.
-
writeBytes
Description copied from interface:Buffer
Transfers the specified source buffer's data to this buffer starting at the currentwriterIndex
until the source buffer becomes unreadable, and increases thewriterIndex
by the number of the transferred bytes. This method is basically same withBuffer.writeBytes(Buffer, int, int)
, except that this method increases thereaderIndex
of the source buffer by the number of the transferred bytes whileBuffer.writeBytes(Buffer, int, int)
does not. Ifthis.writableBytes
is less thansrc.readableBytes
,Buffer.ensureWritable(int)
will be called in an attempt to expand capacity to accommodate.- Specified by:
writeBytes
in interfaceBuffer
- Parameters:
src
- the buffer to write.- Returns:
- self.
-
writeBytes
Description copied from interface:Buffer
Transfers the specified source buffer's data to this buffer starting at the currentwriterIndex
and increases thewriterIndex
by the number of the transferred bytes (=length
). This method is basically same withBuffer.writeBytes(Buffer, int, int)
, except that this method increases thereaderIndex
of the source buffer by the number of the transferred bytes (=length
) whileBuffer.writeBytes(Buffer, int, int)
does not. Ifthis.writableBytes
is less thanlength
,Buffer.ensureWritable(int)
will be called in an attempt to expand capacity to accommodate.- Specified by:
writeBytes
in interfaceBuffer
- Parameters:
src
- the buffer to write.length
- the number of bytes to transfer- Returns:
- self.
-
writeBytes
Description copied from interface:Buffer
Transfers the specified source buffer's data to this buffer starting at the currentwriterIndex
and increases thewriterIndex
by the number of the transferred bytes (=length
). Ifthis.writableBytes
is less thanlength
,Buffer.ensureWritable(int)
will be called in an attempt to expand capacity to accommodate.- Specified by:
writeBytes
in interfaceBuffer
- Parameters:
src
- the buffer to write.srcIndex
- the first index of the sourcelength
- the number of bytes to transfer- Returns:
- self.
-
writeBytes
Description copied from interface:Buffer
Transfers the specified source array's data to this buffer starting at the currentwriterIndex
and increases thewriterIndex
by the number of the transferred bytes (=src.length
). Ifthis.writableBytes
is less thansrc.length
,Buffer.ensureWritable(int)
will be called in an attempt to expand capacity to accommodate.- Specified by:
writeBytes
in interfaceBuffer
- Parameters:
src
- the array to write.- Returns:
- self.
-
writeBytes
Description copied from interface:Buffer
Transfers the specified source array's data to this buffer starting at the currentwriterIndex
and increases thewriterIndex
by the number of the transferred bytes (=length
). Ifthis.writableBytes
is less thanlength
,Buffer.ensureWritable(int)
will be called in an attempt to expand capacity to accommodate.- Specified by:
writeBytes
in interfaceBuffer
- Parameters:
src
- the array to write.srcIndex
- the first index of the sourcelength
- the number of bytes to transfer- Returns:
- self.
-
writeBytes
Description copied from interface:Buffer
Transfers the specified source buffer's data to this buffer starting at the currentwriterIndex
until the source buffer's position reaches its limit, and increases thewriterIndex
by the number of the transferred bytes. Ifthis.writableBytes
is less thansrc.remaining()
,Buffer.ensureWritable(int)
will be called in an attempt to expand capacity to accommodate.- Specified by:
writeBytes
in interfaceBuffer
- Parameters:
src
- the source buffer to write.- Returns:
- self.
-
writeAscii
Description copied from interface:Buffer
Encode aCharSequence
in ASCII and write it to this buffer starting atwriterIndex
and increases thewriterIndex
by the number of the transferred bytes. Ifthis.writableBytes
is not large enough to write the whole sequence,Buffer.ensureWritable(int)
will be called in an attempt to expand capacity to accommodate.- Specified by:
writeAscii
in interfaceBuffer
- Parameters:
seq
- the source of the data.- Returns:
- self.
-
writeUtf8
Description copied from interface:Buffer
Encode aCharSequence
in UTF-8 and write it to this buffer starting atwriterIndex
and increases thewriterIndex
by the number of the transferred bytes. Ifthis.writableBytes
is not large enough to write the whole sequence,Buffer.ensureWritable(int)
will be called in an attempt to expand capacity to accommodate.
-