public class ByteBufferOutputStream extends OutputStream implements OutputStreaming
| Constructor and Description | 
|---|
ByteBufferOutputStream(ByteBuffer buffer)
Construct a ByteBufferOutputStream on a ByteBuffer object. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
close()
Close the stream, flushing any accumulated bytes. 
 | 
void | 
flush()
Flush any accumulated bytes. 
 | 
ByteBuffer | 
getByteBuffer()
Obtain the ByteBuffer that this OutputStream is based on. 
 | 
protected static String | 
includeMessage(Throwable e)
Provide a "suffix" containing the exception message (if any). 
 | 
protected NullPointerException | 
potentialStreamClosedException(NullPointerException e)
Check if an NPE is caused by the stream being closed. 
 | 
void | 
write(byte[] abSrc,
     int ofSrc,
     int cbSrc)
Writes  
len bytes from the specified byte array
 starting at offset off to this output stream. | 
void | 
write(int b)
Writes the specified byte to this output stream. 
 | 
writepublic ByteBufferOutputStream(ByteBuffer buffer)
buffer - the ByteBuffer to write the data topublic ByteBuffer getByteBuffer()
public void write(int b)
           throws IOException
write in interface com.oracle.common.io.OutputStreamingwrite in class OutputStreamb - the byteIOException - if an I/O error occurspublic void write(byte[] abSrc,
                  int ofSrc,
                  int cbSrc)
           throws IOException
len bytes from the specified byte array
 starting at offset off to this output stream.
 
 If b is null, a
 NullPointerException is thrown.
 
 If off is negative, or len is negative, or
 off+len is greater than the length of the array
 b, then an IndexOutOfBoundsException is thrown.
write in interface com.oracle.common.io.OutputStreamingwrite in class OutputStreamabSrc - the dataofSrc - the start offset in the datacbSrc - the number of bytes to writeIOException - if an I/O error occurspublic void flush()
           throws IOException
flush in interface com.oracle.common.io.OutputStreamingflush in interface Flushableflush in class OutputStreamIOException - if an I/O error occurspublic void close()
           throws IOException
close in interface com.oracle.common.io.OutputStreamingclose in interface Closeableclose in interface AutoCloseableclose in class OutputStreamIOException - if an I/O error occursprotected static String includeMessage(Throwable e)
e - an exception (any Throwable object)protected NullPointerException potentialStreamClosedException(NullPointerException e) throws IOException
e - an NPEIOException - if the stream is closed