com.sun.xml.ws.transport.tcp.io
Class ByteBufferInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by com.sun.xml.ws.transport.tcp.io.ByteBufferInputStream
All Implemented Interfaces:
java.io.Closeable

public class ByteBufferInputStream
extends java.io.InputStream

Stream wrapper around a ByteBuffer


Constructor Summary
ByteBufferInputStream(java.nio.ByteBuffer byteBuffer)
           
 
Method Summary
 int available()
          Return the available bytes
 void close()
          Close this stream.
 boolean markSupported()
          Return true if mark is supported.
 int read()
          Read the first byte from the wrapped ByteBuffer.
 int read(byte[] b)
          Read the bytes from the wrapped ByteBuffer.
 int read(byte[] b, int offset, int length)
          Read the first byte of the wrapped ByteBuffer.
 void setByteBuffer(java.nio.ByteBuffer byteBuffer)
          Set the wrapped ByteBuffer
 
Methods inherited from class java.io.InputStream
mark, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteBufferInputStream

public ByteBufferInputStream(java.nio.ByteBuffer byteBuffer)
Method Detail

setByteBuffer

public void setByteBuffer(java.nio.ByteBuffer byteBuffer)
Set the wrapped ByteBuffer

Parameters:
byteBuffer - The wrapped byteBuffer

available

public int available()
Return the available bytes

Overrides:
available in class java.io.InputStream
Returns:
the wrapped byteBuffer.remaining()

close

public void close()
Close this stream.

Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.InputStream

markSupported

public boolean markSupported()
Return true if mark is supported.

Overrides:
markSupported in class java.io.InputStream

read

public int read()
Read the first byte from the wrapped ByteBuffer.

Specified by:
read in class java.io.InputStream

read

public int read(byte[] b)
Read the bytes from the wrapped ByteBuffer.

Overrides:
read in class java.io.InputStream

read

public int read(byte[] b,
                int offset,
                int length)
Read the first byte of the wrapped ByteBuffer.

Overrides:
read in class java.io.InputStream