org.jboss.media.util
Class ByteBufferUtils

java.lang.Object
  extended byorg.jboss.media.util.ByteBufferUtils

public class ByteBufferUtils
extends java.lang.Object

This class implements methods for creating an input or output stream on a ByteBuffer.

Obtain or create a ByteBuffer:

ByteBuffer buf = ByteBuffer.allocate(10);

Create an output stream on the ByteBuffer:

OutputStream os = newOutputStream(buf);

Create an input stream on the ByteBuffer:

InputStream is = newInputStream(buf);


Constructor Summary
ByteBufferUtils()
           
 
Method Summary
static java.io.InputStream newInputStream(java.nio.ByteBuffer buf)
          Returns an input stream for a ByteBuffer.
static java.io.OutputStream newOutputStream(java.nio.ByteBuffer buf)
          Returns an output stream for a ByteBuffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteBufferUtils

public ByteBufferUtils()
Method Detail

newOutputStream

public static java.io.OutputStream newOutputStream(java.nio.ByteBuffer buf)
Returns an output stream for a ByteBuffer. The write() methods use the relative ByteBuffer put() methods.


newInputStream

public static java.io.InputStream newInputStream(java.nio.ByteBuffer buf)
Returns an input stream for a ByteBuffer. The read() methods use the relative ByteBuffer get() methods.