public class DynamicSliceOutput extends SliceOutput
| Constructor and Description |
|---|
DynamicSliceOutput(int estimatedSize) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
isWritable()
Returns
true
if and only if (this.capacity - this.writerIndex) is greater
than 0. |
void |
reset()
Resets this stream to the initial position.
|
int |
size()
Returns the
writerIndex of this buffer. |
Slice |
slice()
Returns a slice of this buffer's readable bytes.
|
ByteBuffer |
toByteBuffer()
Converts this buffer's readable bytes into a NIO buffer.
|
String |
toString() |
String |
toString(Charset charset)
Decodes this buffer's readable bytes into a string with the specified
character set name.
|
int |
writableBytes()
Returns the number of writable bytes which is equal to
(this.capacity - this.writerIndex). |
void |
writeByte(int value)
Sets the specified byte at the current
writerIndex
and increases the writerIndex by 1 in this buffer. |
void |
writeBytes(byte[] source)
Transfers the specified source array's data to this buffer starting at
the current
writerIndex and increases the writerIndex
by the number of the transferred bytes (= source.length). |
void |
writeBytes(byte[] source,
int sourceIndex,
int length)
Transfers the specified source array's data to this buffer starting at
the current
writerIndex and increases the writerIndex
by the number of the transferred bytes (= length). |
void |
writeBytes(ByteBuffer source)
Transfers the specified source buffer's data to this buffer starting at
the current
writerIndex until the source buffer's position
reaches its limit, and increases the writerIndex by the
number of the transferred bytes. |
int |
writeBytes(FileChannel in,
int position,
int length) |
int |
writeBytes(InputStream in,
int length)
Transfers the content of the specified stream to this buffer
starting at the current
writerIndex and increases the
writerIndex by the number of the transferred bytes. |
int |
writeBytes(ScatteringByteChannel in,
int length)
Transfers the content of the specified channel to this buffer
starting at the current
writerIndex and increases the
writerIndex by the number of the transferred bytes. |
void |
writeBytes(Slice source)
Transfers the specified source buffer's data to this buffer starting at
the current
writerIndex until the source buffer becomes
unreadable, and increases the writerIndex by the number of
the transferred bytes. |
void |
writeBytes(SliceInput source,
int length)
Transfers the specified source buffer's data to this buffer starting at
the current
writerIndex and increases the writerIndex
by the number of the transferred bytes (= length). |
void |
writeBytes(Slice source,
int sourceIndex,
int length)
Transfers the specified source buffer's data to this buffer starting at
the current
writerIndex and increases the writerIndex
by the number of the transferred bytes (= length). |
void |
writeInt(int value)
Sets the specified 32-bit integer at the current
writerIndex
and increases the writerIndex by 4 in this buffer. |
void |
writeLong(long value)
Sets the specified 64-bit long integer at the current
writerIndex and increases the writerIndex by 8
in this buffer. |
void |
writeShort(int value)
Sets the specified 16-bit short integer at the current
writerIndex and increases the writerIndex by 2
in this buffer. |
void |
writeZero(int length)
Fills this buffer with NUL (0x00) starting at the current
writerIndex and increases the writerIndex by the
specified length. |
write, write, write, writeBoolean, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeUTFclose, flushpublic void reset()
SliceOutputreset in class SliceOutputpublic int size()
SliceOutputwriterIndex of this buffer.size in class SliceOutputpublic boolean isWritable()
SliceOutputtrue
if and only if (this.capacity - this.writerIndex) is greater
than 0.isWritable in class SliceOutputpublic int writableBytes()
SliceOutput(this.capacity - this.writerIndex).writableBytes in class SliceOutputpublic void writeByte(int value)
SliceOutputwriterIndex
and increases the writerIndex by 1 in this buffer.
The 24 high-order bits of the specified value are ignored.writeByte in interface DataOutputwriteByte in class SliceOutputpublic void writeShort(int value)
SliceOutputwriterIndex and increases the writerIndex by 2
in this buffer. The 16 high-order bits of the specified value are ignored.writeShort in interface DataOutputwriteShort in class SliceOutputpublic void writeInt(int value)
SliceOutputwriterIndex
and increases the writerIndex by 4 in this buffer.writeInt in interface DataOutputwriteInt in class SliceOutputpublic void writeLong(long value)
SliceOutputwriterIndex and increases the writerIndex by 8
in this buffer.writeLong in interface DataOutputwriteLong in class SliceOutputpublic void writeBytes(byte[] source)
SliceOutputwriterIndex and increases the writerIndex
by the number of the transferred bytes (= source.length).writeBytes in class SliceOutputpublic void writeBytes(byte[] source,
int sourceIndex,
int length)
SliceOutputwriterIndex and increases the writerIndex
by the number of the transferred bytes (= length).writeBytes in class SliceOutputsourceIndex - the first index of the sourcelength - the number of bytes to transferpublic void writeBytes(Slice source)
SliceOutputwriterIndex until the source buffer becomes
unreadable, and increases the writerIndex by the number of
the transferred bytes. This method is basically same with
SliceOutput.writeBytes(Slice, int, int), except that this method
increases the readerIndex of the source buffer by the number of
the transferred bytes while SliceOutput.writeBytes(Slice, int, int)
does not.writeBytes in class SliceOutputpublic void writeBytes(SliceInput source, int length)
SliceOutputwriterIndex and increases the writerIndex
by the number of the transferred bytes (= length). This method
is basically same with SliceOutput.writeBytes(Slice, int, int),
except that this method increases the readerIndex of the source
buffer by the number of the transferred bytes (= length) while
SliceOutput.writeBytes(Slice, int, int) does not.writeBytes in class SliceOutputlength - the number of bytes to transferpublic void writeBytes(Slice source, int sourceIndex, int length)
SliceOutputwriterIndex and increases the writerIndex
by the number of the transferred bytes (= length).writeBytes in class SliceOutputsourceIndex - the first index of the sourcelength - the number of bytes to transferpublic void writeBytes(ByteBuffer source)
SliceOutputwriterIndex until the source buffer's position
reaches its limit, and increases the writerIndex by the
number of the transferred bytes.writeBytes in class SliceOutputpublic int writeBytes(InputStream in, int length) throws IOException
SliceOutputwriterIndex and increases the
writerIndex by the number of the transferred bytes.writeBytes in class SliceOutputlength - the number of bytes to transferIOException - if the specified stream threw an exception during I/Opublic int writeBytes(ScatteringByteChannel in, int length) throws IOException
SliceOutputwriterIndex and increases the
writerIndex by the number of the transferred bytes.writeBytes in class SliceOutputlength - the maximum number of bytes to transferIOException - if the specified channel threw an exception during I/Opublic int writeBytes(FileChannel in, int position, int length) throws IOException
writeBytes in class SliceOutputIOExceptionpublic void writeZero(int length)
SliceOutputwriterIndex and increases the writerIndex by the
specified length.writeZero in class SliceOutputlength - the number of NULs to write to the bufferpublic Slice slice()
SliceOutputbuf.slice(buf.readerIndex(), buf.readableBytes()).
This method does not modify readerIndex or writerIndex of
this buffer.slice in class SliceOutputpublic ByteBuffer toByteBuffer()
SliceOutputbuf.toByteBuffer(buf.readerIndex(), buf.readableBytes()).
This method does not modify readerIndex or writerIndex of
this buffer.toByteBuffer in class SliceOutputpublic String toString(Charset charset)
SliceOutputbuf.toString(buf.readerIndex(), buf.readableBytes(), charsetName).
This method does not modify readerIndex or writerIndex of
this buffer.toString in class SliceOutputCopyright © 2011–2019. All rights reserved.