atg.test.io
Class ByteBufferOutputStream

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

public class ByteBufferOutputStream
extends java.io.OutputStream

An output stream which allows writing to a ByteBuffer

Version:
$Id:$
Author:
Adam Belmont
See Also:
ByteBuffer

Constructor Summary
ByteBufferOutputStream(java.nio.ByteBuffer pBuffer)
          Creates a new ByteBufferOutputStream which writes into the given ByteBuffer.
 
Method Summary
 void write(byte[] bytes, int off, int len)
           
 void write(int b)
           
 
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
 

Constructor Detail

ByteBufferOutputStream

public ByteBufferOutputStream(java.nio.ByteBuffer pBuffer)
Creates a new ByteBufferOutputStream which writes into the given ByteBuffer. Note that you should class ByteBuffer.flip() after writing to this stream in order to make the buffer available for reading with a ByteBufferInputStream.

Parameters:
pBuffer -
See Also:
ByteBufferInputStream
Method Detail

write

public void write(int b)
           throws java.io.IOException
Specified by:
write in class java.io.OutputStream
Throws:
java.io.IOException

write

public void write(byte[] bytes,
                  int off,
                  int len)
           throws java.io.IOException
Overrides:
write in class java.io.OutputStream
Throws:
java.io.IOException


Copyright © 2009. All Rights Reserved.