com.bigdata.io
Class ByteBufferOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by com.bigdata.io.ByteBufferOutputStream
All Implemented Interfaces:
Closeable, Flushable

public class ByteBufferOutputStream
extends OutputStream

Writes bytes onto a ByteBuffer.

Version:
$Id: ByteBufferOutputStream.java 2265 2009-10-26 12:51:06Z thompsonbry $
Author:
Bryan Thompson

Field Summary
protected  ByteBuffer buf
           
 
Constructor Summary
ByteBufferOutputStream(ByteBuffer buf)
           
 
Method Summary
 ByteBuffer getByteBuffer()
           
 void write(byte[] b, int off, int len)
          Write an array of bytes on the buffer.
 void write(int b)
          Write a byte on the buffer.
 
Methods inherited from class java.io.OutputStream
close, flush, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

buf

protected final ByteBuffer buf
Constructor Detail

ByteBufferOutputStream

public ByteBufferOutputStream(ByteBuffer buf)
Method Detail

getByteBuffer

public final ByteBuffer getByteBuffer()

write

public void write(int b)
           throws IOException
Write a byte on the buffer. The Buffer.position() is advanced as a side effect.

Specified by:
write in class OutputStream
Parameters:
b - A byte whose value is in [-128:127].
Throws:
EOFException - if the buffer would overflow.
IOException

write

public void write(byte[] b,
                  int off,
                  int len)
           throws IOException
Write an array of bytes on the buffer. The Buffer.position() is advanced as a side effect.

Overrides:
write in class OutputStream
Parameters:
b - the data.
off - the start offset in the data.
len - the number of bytes to write.
Throws:
EOFException - if the buffer would overflow.
IOException


Copyright © 2006-2009 SYSTAP, LLC. All Rights Reserved.