- java.lang.Object
-
- java.io.OutputStream
-
- io.netty5.buffer.BufferOutputStream
-
- All Implemented Interfaces:
Closeable,DataOutput,Flushable,AutoCloseable
public final class BufferOutputStream extends OutputStream implements DataOutput
AnOutputStreamwhich writes data to aBuffer.A write operation against this stream will occur at the
writerOffsetof its underlying buffer and thewriterOffsetwill increase during the write operation.This stream implements
DataOutputfor your convenience. The endianness of the stream is always big endian.- See Also:
BufferInputStream
-
-
Constructor Summary
Constructors Constructor Description BufferOutputStream(Buffer buffer)Creates a new stream which writes data to the specifiedbuffer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Bufferbuffer()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)voidwriteUTF(String s)intwrittenBytes()Returns the number of written bytes by this stream so far.-
Methods inherited from class java.io.OutputStream
flush, nullOutputStream
-
-
-
-
Constructor Detail
-
BufferOutputStream
public BufferOutputStream(Buffer buffer)
Creates a new stream which writes data to the specifiedbuffer.
-
-
Method Detail
-
writtenBytes
public int writtenBytes()
Returns the number of written bytes by this stream so far.
-
write
public void write(byte[] b, int off, int len) throws IOException- Specified by:
writein interfaceDataOutput- Overrides:
writein classOutputStream- Throws:
IOException
-
write
public void write(byte[] b) throws IOException- Specified by:
writein interfaceDataOutput- Overrides:
writein classOutputStream- Throws:
IOException
-
write
public void write(int b) throws IOException- Specified by:
writein interfaceDataOutput- Specified by:
writein classOutputStream- Throws:
IOException
-
writeBoolean
public void writeBoolean(boolean v) throws IOException- Specified by:
writeBooleanin interfaceDataOutput- Throws:
IOException
-
writeByte
public void writeByte(int v) throws IOException- Specified by:
writeBytein interfaceDataOutput- Throws:
IOException
-
writeBytes
public void writeBytes(String s) throws IOException
- Specified by:
writeBytesin interfaceDataOutput- Throws:
IOException
-
writeChar
public void writeChar(int v) throws IOException- Specified by:
writeCharin interfaceDataOutput- Throws:
IOException
-
writeChars
public void writeChars(String s) throws IOException
- Specified by:
writeCharsin interfaceDataOutput- Throws:
IOException
-
writeDouble
public void writeDouble(double v) throws IOException- Specified by:
writeDoublein interfaceDataOutput- Throws:
IOException
-
writeFloat
public void writeFloat(float v) throws IOException- Specified by:
writeFloatin interfaceDataOutput- Throws:
IOException
-
writeInt
public void writeInt(int v) throws IOException- Specified by:
writeIntin interfaceDataOutput- Throws:
IOException
-
writeLong
public void writeLong(long v) throws IOException- Specified by:
writeLongin interfaceDataOutput- Throws:
IOException
-
writeShort
public void writeShort(int v) throws IOException- Specified by:
writeShortin interfaceDataOutput- Throws:
IOException
-
writeUTF
public void writeUTF(String s) throws IOException
- Specified by:
writeUTFin interfaceDataOutput- Throws:
IOException
-
buffer
public Buffer buffer()
Returns the buffer where this stream is writing data.
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-
-