public class BasicSliceOutput extends SliceOutput
| Modifier | Constructor and Description |
|---|---|
protected |
BasicSliceOutput(Slice slice) |
| Modifier and Type | Method and Description |
|---|---|
BasicSliceOutput |
appendByte(int value) |
BasicSliceOutput |
appendBytes(byte[] source) |
BasicSliceOutput |
appendBytes(byte[] source,
int sourceIndex,
int length) |
BasicSliceOutput |
appendBytes(Slice slice) |
SliceOutput |
appendDouble(double value) |
BasicSliceOutput |
appendInt(int value) |
BasicSliceOutput |
appendLong(long value) |
BasicSliceOutput |
appendShort(int value) |
int |
getRetainedSize()
Approximate number of bytes retained by this.
|
Slice |
getUnderlyingSlice()
Returns the raw underlying slice of this output stream.
|
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.
|
void |
reset(int position)
Resets this stream to the specified position.
|
int |
size()
Returns the
writerIndex of this buffer. |
Slice |
slice()
Returns a slice of this buffer's readable bytes.
|
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(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. |
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(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 |
writeDouble(double value)
Sets the specified 64-bit double at the current
writerIndex and increases the writerIndex by 8
in this buffer. |
void |
writeFloat(float value)
Sets the specified 32-bit float at the current
writerIndex and increases the writerIndex by 4
in this buffer. |
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. |
write, write, write, writeBoolean, writeBytes, writeChar, writeChars, writeUTF, writeZeroclose, flushprotected BasicSliceOutput(Slice slice)
public void reset()
SliceOutputreset in class SliceOutputpublic void reset(int position)
SliceOutputreset in class SliceOutputpublic int size()
SliceOutputwriterIndex of this buffer.size in class SliceOutputpublic int getRetainedSize()
SliceOutputgetRetainedSize 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 writeFloat(float value)
SliceOutputwriterIndex and increases the writerIndex by 4
in this buffer.writeFloat in interface DataOutputwriteFloat in class SliceOutputpublic void writeDouble(double value)
SliceOutputwriterIndex and increases the writerIndex by 8
in this buffer.writeDouble in interface DataOutputwriteDouble 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(byte[] source)
SliceOutputwriterIndex and increases the writerIndex
by the number of the transferred bytes (= source.length).writeBytes in class SliceOutputpublic 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(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(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 BasicSliceOutput appendLong(long value)
appendLong in class SliceOutputpublic SliceOutput appendDouble(double value)
appendDouble in class SliceOutputpublic BasicSliceOutput appendInt(int value)
appendInt in class SliceOutputpublic BasicSliceOutput appendShort(int value)
appendShort in class SliceOutputpublic BasicSliceOutput appendByte(int value)
appendByte in class SliceOutputpublic BasicSliceOutput appendBytes(byte[] source, int sourceIndex, int length)
appendBytes in class SliceOutputpublic BasicSliceOutput appendBytes(byte[] source)
appendBytes in class SliceOutputpublic BasicSliceOutput appendBytes(Slice slice)
appendBytes in class SliceOutputpublic Slice slice()
SliceOutputbuf.slice(buf.readerIndex(), buf.readableBytes()).
This method does not modify readerIndex or writerIndex of
this buffer.slice in class SliceOutputpublic Slice getUnderlyingSlice()
SliceOutputgetUnderlyingSlice 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 © 2012-2017. All Rights Reserved.