public final class WriteBuffer extends OutputStream
| Constructor and Description |
|---|
WriteBuffer(PageBuffer pageBuffer,
Consumer<WriteBuffer> consumer,
int chunkSize,
int capacity) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
flush() |
boolean |
isEmpty()
是否存在待输出的数据
|
VirtualBuffer |
poll()
获取并移除当前缓冲队列中头部的VirtualBuffer
|
VirtualBuffer |
pollItem() |
void |
write(byte[] b,
int off,
int len) |
void |
write(ByteBuffer buffer) |
void |
write(int b)
按照
OutputStream.write(int)规范:要写入的字节是参数 b 的八个低位。 b 的 24 个高位将被忽略。
而使用该接口时容易传入非byte范围内的数据,接口定义与实际使用出现歧义的可能性较大,故建议废弃该方法,选用writeByte(byte)。 |
void |
write(VirtualBuffer virtualBuffer) |
void |
writeAndFlush(byte[] b)
写入内容并刷新缓冲区
|
void |
writeAndFlush(byte[] b,
int off,
int len) |
void |
writeByte(byte b) |
void |
writeInt(int v)
输出int数值,占用4个字节
|
void |
writeLong(long v)
输出long数值,占用8个字节
|
void |
writeShort(short v)
输出一个short类型的数据
|
writepublic WriteBuffer(PageBuffer pageBuffer, Consumer<WriteBuffer> consumer, int chunkSize, int capacity)
public void write(int b)
OutputStream.write(int)规范:要写入的字节是参数 b 的八个低位。 b 的 24 个高位将被忽略。
而使用该接口时容易传入非byte范围内的数据,接口定义与实际使用出现歧义的可能性较大,故建议废弃该方法,选用writeByte(byte)。write in class OutputStreamb - 输出字节public void writeShort(short v)
throws IOException
v - short数值IOException - IO异常public void writeByte(byte b)
b - 待输出数值write(int)public void writeInt(int v)
throws IOException
v - int数值IOException - IO异常public void writeLong(long v)
throws IOException
v - long数值IOException - IO异常public void write(byte[] b,
int off,
int len)
throws IOException
write in class OutputStreamIOExceptionpublic void write(ByteBuffer buffer)
public void write(VirtualBuffer virtualBuffer)
public void writeAndFlush(byte[] b)
throws IOException
b - 待输出数据IOException - 如果发生 I/O 错误public void writeAndFlush(byte[] b,
int off,
int len)
throws IOException
b - 待输出数据off - b的起始位点len - 从b中输出的数据长度IOException - 如果发生 I/O 错误writeAndFlush(byte[])public void flush()
flush in interface Flushableflush in class OutputStreampublic void close()
close in interface Closeableclose in interface AutoCloseableclose in class OutputStreampublic boolean isEmpty()
public VirtualBuffer pollItem()
public VirtualBuffer poll()
Copyright © 2022. All rights reserved.