@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
在类中 ByteBufferOutputStream
public ByteBuffer getByteBuffer()
ByteBufferOutputStream
getByteBuffer
在类中 ByteBufferOutputStream
protected void checkSizeAndGrow(int extra)
public void writeTo(OutputStream out) throws IOException
ByteBufferOutputStream
writeTo
在类中 ByteBufferOutputStream
out
- 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
在类中 ByteBufferOutputStream
public List<ByteBuffer> getByteBuffers()
public void write(byte[] b, int off, int len) throws IOException
write
在类中 ByteBufferOutputStream
IOException
public void write(ByteBuffer b, int off, int len) throws IOException
ByteBufferWriter
len
bytes from the specified ByteBuffer starting at offset off
write
在接口中 ByteBufferWriter
write
在类中 ByteBufferOutputStream
b
- 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–2018 The Apache Software Foundation. All rights reserved.