@InterfaceAudience.Public @InterfaceStability.Evolving public class ByteBufferOutputStream extends OutputStream
Modifier and Type | Field and Description |
---|---|
protected ByteBuffer |
buf |
Constructor and Description |
---|
ByteBufferOutputStream(int capacity) |
ByteBufferOutputStream(int capacity,
boolean useDirectByteBuffer) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
flush() |
ByteBuffer |
getByteBuffer()
This flips the underlying BB so be sure to use it _last_!
|
int |
size() |
byte[] |
toByteArray(int offset,
int length) |
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
void |
writeTo(OutputStream out)
Writes the complete contents of this byte buffer output stream to
the specified output stream argument.
|
protected ByteBuffer buf
public ByteBufferOutputStream(int capacity)
public ByteBufferOutputStream(int capacity, boolean useDirectByteBuffer)
public int size()
public ByteBuffer getByteBuffer()
public void write(int b) throws IOException
write
in class OutputStream
IOException
public void writeTo(OutputStream out) throws IOException
out
- the output stream to which to write the data.IOException
- if an I/O error occurs.public void write(byte[] b) throws IOException
write
in class OutputStream
IOException
public void write(byte[] b, int off, int len) throws IOException
write
in class OutputStream
IOException
public void flush() throws IOException
flush
in interface Flushable
flush
in class OutputStream
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class OutputStream
IOException
public byte[] toByteArray(int offset, int length)
Copyright © 2007-2016 The Apache Software Foundation. All Rights Reserved.