Package io.netty.buffer
Class ByteBufOutputStream
java.lang.Object
java.io.OutputStream
io.netty.buffer.ByteBufOutputStream
- All Implemented Interfaces:
Closeable,DataOutput,Flushable,AutoCloseable
An
OutputStream which writes data to a ByteBuf.
A write operation against this stream will occur at the writerIndex
of its underlying buffer and the writerIndex will increase during
the write operation.
This stream implements DataOutput for your convenience.
The endianness of the stream is not always big endian but depends on
the endianness of the underlying buffer.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionByteBufOutputStream(ByteBuf buffer) Creates a new stream which writes data to the specifiedbuffer. -
Method Summary
Modifier and TypeMethodDescriptionbuffer()Returns the buffer where this stream is writing data.voidclose()voidwrite(byte[] b) voidwrite(byte[] b, int off, int len) voidwrite(int b) voidwriteBoolean(boolean v) voidwriteByte(int v) voidwriteBytes(String s) voidwriteChar(int v) voidwriteChars(String s) voidwriteDouble(double v) voidwriteFloat(float v) voidwriteInt(int v) voidwriteLong(long v) voidwriteShort(int v) voidintReturns the number of written bytes by this stream so far.Methods inherited from class java.io.OutputStream
flush, nullOutputStream
-
Constructor Details
-
ByteBufOutputStream
Creates a new stream which writes data to the specifiedbuffer.
-
-
Method Details
-
writtenBytes
public int writtenBytes()Returns the number of written bytes by this stream so far. -
write
- Specified by:
writein interfaceDataOutput- Overrides:
writein classOutputStream- Throws:
IOException
-
write
- Specified by:
writein interfaceDataOutput- Overrides:
writein classOutputStream- Throws:
IOException
-
write
- Specified by:
writein interfaceDataOutput- Specified by:
writein classOutputStream- Throws:
IOException
-
writeBoolean
- Specified by:
writeBooleanin interfaceDataOutput- Throws:
IOException
-
writeByte
- Specified by:
writeBytein interfaceDataOutput- Throws:
IOException
-
writeBytes
- Specified by:
writeBytesin interfaceDataOutput- Throws:
IOException
-
writeChar
- Specified by:
writeCharin interfaceDataOutput- Throws:
IOException
-
writeChars
- Specified by:
writeCharsin interfaceDataOutput- Throws:
IOException
-
writeDouble
- Specified by:
writeDoublein interfaceDataOutput- Throws:
IOException
-
writeFloat
- Specified by:
writeFloatin interfaceDataOutput- Throws:
IOException
-
writeInt
- Specified by:
writeIntin interfaceDataOutput- Throws:
IOException
-
writeLong
- Specified by:
writeLongin interfaceDataOutput- Throws:
IOException
-
writeShort
- Specified by:
writeShortin interfaceDataOutput- Throws:
IOException
-
writeUTF
- Specified by:
writeUTFin interfaceDataOutput- Throws:
IOException
-
buffer
Returns the buffer where this stream is writing data. -
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-