@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 OutputStreamIOExceptionpublic 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 OutputStreamIOExceptionpublic void write(byte[] b,
int off,
int len)
throws IOException
write in class OutputStreamIOExceptionpublic void flush()
throws IOException
flush in interface Flushableflush in class OutputStreamIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class OutputStreamIOExceptionpublic byte[] toByteArray(int offset,
int length)
Copyright © 2014 The Apache Software Foundation. All rights reserved.