Package org.apache.avro.util
Class ByteBufferOutputStream
java.lang.Object
java.io.OutputStream
org.apache.avro.util.ByteBufferOutputStream
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
Utility to collect data written to an
OutputStream
in
ByteBuffer
s.-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
append
(List<ByteBuffer> lists) Append a list of ByteBuffers to this stream.Returns all data written and resets the stream to be empty.void
prepend
(List<ByteBuffer> lists) Prepend a list of ByteBuffers to this stream.void
reset()
void
write
(byte[] b, int off, int len) void
write
(int b) void
write
(ByteBuffer buffer) void
writeBuffer
(ByteBuffer buffer) Add a buffer to the output without copying, if possible.Methods inherited from class java.io.OutputStream
close, flush, nullOutputStream, write
-
Field Details
-
BUFFER_SIZE
public static final int BUFFER_SIZE- See Also:
-
-
Constructor Details
-
ByteBufferOutputStream
public ByteBufferOutputStream()
-
-
Method Details
-
getBufferList
Returns all data written and resets the stream to be empty. -
prepend
Prepend a list of ByteBuffers to this stream. -
append
Append a list of ByteBuffers to this stream. -
reset
public void reset() -
write
-
write
public void write(int b) - Specified by:
write
in classOutputStream
-
write
public void write(byte[] b, int off, int len) - Overrides:
write
in classOutputStream
-
writeBuffer
Add a buffer to the output without copying, if possible.- Throws:
IOException
-