public class ByteBufOutputStream extends OutputStream implements DataOutput
OutputStream which writes data to a ByteBuf.
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.
Implement copy from netty io.netty.buffer.ByteBufOutputStream,
The ByteBuf implementation is replaced with cobble.bytebufByteBufInputStream| 构造器和说明 |
|---|
ByteBufOutputStream(ByteBuf buffer)
Creates a new stream which writes data to the specified
buffer. |
ByteBufOutputStream(ByteBuf buffer,
int cacheSize)
Creates a new stream which writes data to the specified
buffer. |
| 限定符和类型 | 方法和说明 |
|---|---|
ByteBuf |
buffer()
Returns the buffer where this stream is writing data.
|
void |
close() |
void |
flush() |
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
void |
writeBoolean(boolean v) |
void |
writeByte(int v) |
void |
writeBytes(String s) |
void |
writeChar(int v) |
void |
writeChars(String s) |
void |
writeDouble(double v) |
void |
writeFloat(float v) |
void |
writeInt(int v) |
void |
writeLong(long v) |
void |
writeMedium(int v) |
void |
writeShort(int v) |
void |
writeUTF(String s) |
int |
writtenBytes()
Returns the number of written bytes by this stream so far.
|
public ByteBufOutputStream(ByteBuf buffer)
buffer. (no cache)public ByteBufOutputStream(ByteBuf buffer, int cacheSize)
buffer.cacheSize - -1 is no cachepublic int writtenBytes()
public void write(byte[] b,
int off,
int len)
throws IOException
write 在接口中 DataOutputwrite 在类中 OutputStreamIOExceptionpublic void write(byte[] b)
throws IOException
write 在接口中 DataOutputwrite 在类中 OutputStreamIOExceptionpublic void write(int b)
throws IOException
write 在接口中 DataOutputwrite 在类中 OutputStreamIOExceptionpublic void writeBoolean(boolean v)
throws IOException
writeBoolean 在接口中 DataOutputIOExceptionpublic void writeByte(int v)
throws IOException
writeByte 在接口中 DataOutputIOExceptionpublic void writeBytes(String s) throws IOException
writeBytes 在接口中 DataOutputIOExceptionpublic void writeChar(int v)
throws IOException
writeChar 在接口中 DataOutputIOExceptionpublic void writeChars(String s) throws IOException
writeChars 在接口中 DataOutputIOExceptionpublic void writeDouble(double v)
throws IOException
writeDouble 在接口中 DataOutputIOExceptionpublic void writeFloat(float v)
throws IOException
writeFloat 在接口中 DataOutputIOExceptionpublic void writeInt(int v)
throws IOException
writeInt 在接口中 DataOutputIOExceptionpublic void writeLong(long v)
throws IOException
writeLong 在接口中 DataOutputIOExceptionpublic void writeShort(int v)
throws IOException
writeShort 在接口中 DataOutputIOExceptionpublic void writeMedium(int v)
throws IOException
IOExceptionpublic void writeUTF(String s) throws IOException
writeUTF 在接口中 DataOutputIOExceptionpublic ByteBuf buffer()
public void flush()
throws IOException
flush 在接口中 Flushableflush 在类中 OutputStreamIOExceptionpublic void close()
throws IOException
close 在接口中 Closeableclose 在接口中 AutoCloseableclose 在类中 OutputStreamIOExceptionCopyright © 2022–2024. All rights reserved.