public abstract class SliceOutput extends OutputStream implements DataOutput
| Constructor and Description |
|---|
SliceOutput() |
| Modifier and Type | Method and Description |
|---|---|
abstract boolean |
isWritable()
Returns
true
if and only if (this.capacity - this.writerIndex) is greater
than 0. |
abstract void |
reset()
Resets this stream to the initial position.
|
abstract int |
size()
Returns the
writerIndex of this buffer. |
abstract Slice |
slice()
Returns a slice of this buffer's readable bytes.
|
abstract ByteBuffer |
toByteBuffer()
Converts this buffer's readable bytes into a NIO buffer.
|
abstract String |
toString(Charset charset)
Decodes this buffer's readable bytes into a string with the specified
character set name.
|
abstract int |
writableBytes()
Returns the number of writable bytes which is equal to
(this.capacity - this.writerIndex). |
void |
write(byte[] source) |
void |
write(byte[] source,
int sourceIndex,
int length) |
void |
write(int value) |
void |
writeBoolean(boolean value) |
abstract void |
writeByte(int value)
Sets the specified byte at the current
writerIndex
and increases the writerIndex by 1 in this buffer. |
abstract 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). |
abstract 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). |
abstract 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. |
abstract int |
writeBytes(FileChannel in,
int position,
int length) |
abstract 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. |
abstract 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. |
abstract 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. |
abstract 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). |
abstract 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 |
writeBytes(String s)
Unsupported operation
|
void |
writeChar(int value)
Unsupported operation
|
void |
writeChars(String s)
Unsupported operation
|
void |
writeDouble(double v)
Unsupported operation
|
void |
writeFloat(float v)
Unsupported operation
|
abstract void |
writeInt(int value)
Sets the specified 32-bit integer at the current
writerIndex
and increases the writerIndex by 4 in this buffer. |
abstract void |
writeLong(long value)
Sets the specified 64-bit long integer at the current
writerIndex and increases the writerIndex by 8
in this buffer. |
abstract 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 |
writeUTF(String s)
Unsupported operation
|
abstract void |
writeZero(int length)
Fills this buffer with NUL (0x00) starting at the current
writerIndex and increases the writerIndex by the
specified length. |
close, flushpublic abstract void reset()
public abstract int size()
writerIndex of this buffer.public abstract int writableBytes()
(this.capacity - this.writerIndex).public abstract boolean isWritable()
true
if and only if (this.capacity - this.writerIndex) is greater
than 0.public final void writeBoolean(boolean value)
writeBoolean in interface DataOutputpublic final void write(int value)
write in interface DataOutputwrite in class OutputStreampublic abstract void writeByte(int value)
writerIndex
and increases the writerIndex by 1 in this buffer.
The 24 high-order bits of the specified value are ignored.writeByte in interface DataOutputIndexOutOfBoundsException - if this.writableBytes is less than 1public abstract void writeShort(int value)
writerIndex and increases the writerIndex by 2
in this buffer. The 16 high-order bits of the specified value are ignored.writeShort in interface DataOutputIndexOutOfBoundsException - if this.writableBytes is less than 2public abstract void writeInt(int value)
writerIndex
and increases the writerIndex by 4 in this buffer.writeInt in interface DataOutputIndexOutOfBoundsException - if this.writableBytes is less than 4public abstract void writeLong(long value)
writerIndex and increases the writerIndex by 8
in this buffer.writeLong in interface DataOutputIndexOutOfBoundsException - if this.writableBytes is less than 8public abstract void writeBytes(Slice source)
writerIndex until the source buffer becomes
unreadable, and increases the writerIndex by the number of
the transferred bytes. This method is basically same with
writeBytes(Slice, int, int), except that this method
increases the readerIndex of the source buffer by the number of
the transferred bytes while writeBytes(Slice, int, int)
does not.IndexOutOfBoundsException - if source.readableBytes is greater than
this.writableBytespublic abstract void writeBytes(SliceInput source, int length)
writerIndex and increases the writerIndex
by the number of the transferred bytes (= length). This method
is basically same with writeBytes(Slice, int, int),
except that this method increases the readerIndex of the source
buffer by the number of the transferred bytes (= length) while
writeBytes(Slice, int, int) does not.length - the number of bytes to transferIndexOutOfBoundsException - if length is greater than this.writableBytes or
if length is greater then source.readableBytespublic abstract void writeBytes(Slice source, int sourceIndex, int length)
writerIndex and increases the writerIndex
by the number of the transferred bytes (= length).sourceIndex - the first index of the sourcelength - the number of bytes to transferIndexOutOfBoundsException - if the specified sourceIndex is less than 0,
if sourceIndex + length is greater than
source.capacity, or
if length is greater than this.writableBytespublic final void write(byte[] source)
throws IOException
write in interface DataOutputwrite in class OutputStreamIOExceptionpublic abstract void writeBytes(byte[] source)
writerIndex and increases the writerIndex
by the number of the transferred bytes (= source.length).IndexOutOfBoundsException - if source.length is greater than this.writableBytespublic final void write(byte[] source,
int sourceIndex,
int length)
write in interface DataOutputwrite in class OutputStreampublic abstract void writeBytes(byte[] source,
int sourceIndex,
int length)
writerIndex and increases the writerIndex
by the number of the transferred bytes (= length).sourceIndex - the first index of the sourcelength - the number of bytes to transferIndexOutOfBoundsException - if the specified sourceIndex is less than 0,
if sourceIndex + length is greater than
source.length, or
if length is greater than this.writableBytespublic abstract void writeBytes(ByteBuffer source)
writerIndex until the source buffer's position
reaches its limit, and increases the writerIndex by the
number of the transferred bytes.IndexOutOfBoundsException - if source.remaining() is greater than
this.writableBytespublic abstract int writeBytes(InputStream in, int length) throws IOException
writerIndex and increases the
writerIndex by the number of the transferred bytes.length - the number of bytes to transferIndexOutOfBoundsException - if length is greater than this.writableBytesIOException - if the specified stream threw an exception during I/Opublic abstract int writeBytes(ScatteringByteChannel in, int length) throws IOException
writerIndex and increases the
writerIndex by the number of the transferred bytes.length - the maximum number of bytes to transferIndexOutOfBoundsException - if length is greater than this.writableBytesIOException - if the specified channel threw an exception during I/Opublic abstract int writeBytes(FileChannel in, int position, int length) throws IOException
IOExceptionpublic abstract void writeZero(int length)
writerIndex and increases the writerIndex by the
specified length.length - the number of NULs to write to the bufferIndexOutOfBoundsException - if length is greater than this.writableBytespublic abstract Slice slice()
buf.slice(buf.readerIndex(), buf.readableBytes()).
This method does not modify readerIndex or writerIndex of
this buffer.public abstract ByteBuffer toByteBuffer()
buf.toByteBuffer(buf.readerIndex(), buf.readableBytes()).
This method does not modify readerIndex or writerIndex of
this buffer.public abstract String toString(Charset charset)
buf.toString(buf.readerIndex(), buf.readableBytes(), charsetName).
This method does not modify readerIndex or writerIndex of
this buffer.UnsupportedCharsetException - if the specified character set name is not supported by the
current VMpublic void writeChar(int value)
writeChar in interface DataOutputUnsupportedOperationException - alwayspublic void writeFloat(float v)
writeFloat in interface DataOutputUnsupportedOperationException - alwayspublic void writeDouble(double v)
writeDouble in interface DataOutputUnsupportedOperationException - alwayspublic void writeChars(String s)
writeChars in interface DataOutputUnsupportedOperationException - alwayspublic void writeUTF(String s)
writeUTF in interface DataOutputUnsupportedOperationException - alwayspublic void writeBytes(String s)
writeBytes in interface DataOutputUnsupportedOperationException - alwaysCopyright © 2011–2019. All rights reserved.