public abstract class SliceOutput extends OutputStream implements DataOutput
Constructor and Description |
---|
SliceOutput() |
Modifier and Type | Method and Description |
---|---|
abstract SliceOutput |
appendByte(int value) |
abstract SliceOutput |
appendBytes(byte[] source) |
abstract SliceOutput |
appendBytes(byte[] source,
int sourceIndex,
int length) |
abstract SliceOutput |
appendBytes(Slice slice) |
abstract SliceOutput |
appendDouble(double value) |
abstract SliceOutput |
appendInt(int value) |
abstract SliceOutput |
appendLong(long value) |
abstract SliceOutput |
appendShort(int value) |
abstract int |
getRetainedSize()
Approximate number of bytes retained by this.
|
abstract Slice |
getUnderlyingSlice()
Returns the raw underlying slice of this output stream.
|
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 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(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 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(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
|
abstract void |
writeDouble(double value)
Sets the specified 64-bit double at the current
writerIndex and increases the writerIndex by 8
in this buffer. |
abstract void |
writeFloat(float v)
Sets the specified 32-bit float at the current
writerIndex and increases the writerIndex by 4
in this buffer. |
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
|
void |
writeZero(int length)
Fills this buffer with NUL (0x00) starting at the current
writerIndex and increases the writerIndex by the
specified length . |
close, flush
public abstract void reset()
public abstract int size()
writerIndex
of this buffer.public abstract int getRetainedSize()
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 DataOutput
public final void write(int value)
write
in interface DataOutput
write
in class OutputStream
public 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 DataOutput
IndexOutOfBoundsException
- if this.writableBytes
is less than 1
public 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 DataOutput
IndexOutOfBoundsException
- if this.writableBytes
is less than 2
public abstract void writeInt(int value)
writerIndex
and increases the writerIndex
by 4
in this buffer.writeInt
in interface DataOutput
IndexOutOfBoundsException
- if this.writableBytes
is less than 4
public abstract void writeLong(long value)
writerIndex
and increases the writerIndex
by 8
in this buffer.writeLong
in interface DataOutput
IndexOutOfBoundsException
- if this.writableBytes
is less than 8
public abstract void writeFloat(float v)
writerIndex
and increases the writerIndex
by 4
in this buffer.writeFloat
in interface DataOutput
IndexOutOfBoundsException
- if this.writableBytes
is less than 4
public abstract void writeDouble(double value)
writerIndex
and increases the writerIndex
by 8
in this buffer.writeDouble
in interface DataOutput
IndexOutOfBoundsException
- if this.writableBytes
is less than 8
public 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.writableBytes
public 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.writableBytes
public final void write(byte[] source) throws IOException
write
in interface DataOutput
write
in class OutputStream
IOException
public 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.writableBytes
public final void write(byte[] source, int sourceIndex, int length)
write
in interface DataOutput
write
in class OutputStream
public 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.writableBytes
public abstract void 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.writableBytes
IOException
- if the specified stream threw an exception during I/Opublic 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.writableBytes
public abstract Slice slice()
buf.slice(buf.readerIndex(), buf.readableBytes())
.
This method does not modify readerIndex
or writerIndex
of
this buffer.public abstract Slice getUnderlyingSlice()
public abstract String toString(Charset charset)
buf.toString(buf.readerIndex(), buf.readableBytes(), charsetName)
.
This method does not modify readerIndex
or writerIndex
of
this buffer.public abstract SliceOutput appendLong(long value)
public abstract SliceOutput appendDouble(double value)
public abstract SliceOutput appendInt(int value)
public abstract SliceOutput appendShort(int value)
public abstract SliceOutput appendByte(int value)
public abstract SliceOutput appendBytes(byte[] source, int sourceIndex, int length)
public abstract SliceOutput appendBytes(byte[] source)
public abstract SliceOutput appendBytes(Slice slice)
public void writeChar(int value)
writeChar
in interface DataOutput
UnsupportedOperationException
- alwayspublic void writeChars(String s)
writeChars
in interface DataOutput
UnsupportedOperationException
- alwayspublic void writeUTF(String s)
writeUTF
in interface DataOutput
UnsupportedOperationException
- alwayspublic void writeBytes(String s)
writeBytes
in interface DataOutput
UnsupportedOperationException
- alwaysCopyright © 2012-2016. All Rights Reserved.