@InterfaceAudience.Private public class ByteBufferListOutputStream extends ByteBufferOutputStream
releaseResources() method once the Stream usage is over and
data is transferred to the wanted destination.
Not thread safe!| 限定符和类型 | 字段和说明 |
|---|---|
protected List<ByteBuffer> |
allBufs |
protected List<ByteBuffer> |
bufsFromPool |
curBuf| 构造器和说明 |
|---|
ByteBufferListOutputStream(ByteBufferPool pool) |
| 限定符和类型 | 方法和说明 |
|---|---|
protected void |
checkSizeAndGrow(int extra) |
ByteBuffer |
getByteBuffer()
This flips the underlying BB so be sure to use it _last_!
|
List<ByteBuffer> |
getByteBuffers()
We can be assured that the buffers returned by this method are all flipped
|
void |
releaseResources()
Release the resources it uses (The ByteBuffers) which are obtained from pool.
|
int |
size() |
byte[] |
toByteArray(int offset,
int length) |
void |
write(byte[] b,
int off,
int len) |
void |
write(ByteBuffer b,
int off,
int len)
Writes
len bytes from the specified ByteBuffer starting at offset off |
void |
writeTo(OutputStream out)
Writes the complete contents of this byte buffer output stream to
the specified output stream argument.
|
protected List<ByteBuffer> allBufs
protected List<ByteBuffer> bufsFromPool
public ByteBufferListOutputStream(ByteBufferPool pool)
public int size()
size 在类中 ByteBufferOutputStreampublic ByteBuffer getByteBuffer()
ByteBufferOutputStreamgetByteBuffer 在类中 ByteBufferOutputStreamprotected void checkSizeAndGrow(int extra)
public void writeTo(OutputStream out) throws IOException
ByteBufferOutputStreamwriteTo 在类中 ByteBufferOutputStreamout - the output stream to which to write the data.IOException - if an I/O error occurs.public void releaseResources()
public byte[] toByteArray(int offset,
int length)
toByteArray 在类中 ByteBufferOutputStreampublic List<ByteBuffer> getByteBuffers()
public void write(byte[] b,
int off,
int len)
throws IOException
write 在类中 ByteBufferOutputStreamIOExceptionpublic void write(ByteBuffer b, int off, int len) throws IOException
ByteBufferWriterlen bytes from the specified ByteBuffer starting at offset offwrite 在接口中 ByteBufferWriterwrite 在类中 ByteBufferOutputStreamb - the data.off - the start offset in the data.len - the number of bytes to write.IOException - if an I/O error occurs.Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.