com.threerings.io
Class ByteBufferInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by com.threerings.io.ByteBufferInputStream
All Implemented Interfaces:
Closeable

public class ByteBufferInputStream
extends InputStream

Reads input from a ByteBuffer.


Field Summary
protected  ByteBuffer _buffer
          The buffer from which we read.
 
Constructor Summary
ByteBufferInputStream(ByteBuffer buffer)
          Creates a new input stream to read from the specified buffer.
 
Method Summary
 int available()
           
 ByteBuffer getBuffer()
          Returns a reference to the underlying buffer.
 void mark(int readLimit)
           
 boolean markSupported()
           
 int read()
           
 int read(byte[] b, int offset, int length)
           
 void reset()
           
 long skip(long n)
           
 
Methods inherited from class java.io.InputStream
close, read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_buffer

protected ByteBuffer _buffer
The buffer from which we read.

Constructor Detail

ByteBufferInputStream

public ByteBufferInputStream(ByteBuffer buffer)
Creates a new input stream to read from the specified buffer.

Method Detail

getBuffer

public ByteBuffer getBuffer()
Returns a reference to the underlying buffer.


read

public int read()
Specified by:
read in class InputStream

read

public int read(byte[] b,
                int offset,
                int length)
         throws IOException
Overrides:
read in class InputStream
Throws:
IOException

skip

public long skip(long n)
          throws IOException
Overrides:
skip in class InputStream
Throws:
IOException

available

public int available()
Overrides:
available in class InputStream

markSupported

public boolean markSupported()
Overrides:
markSupported in class InputStream

mark

public void mark(int readLimit)
Overrides:
mark in class InputStream

reset

public void reset()
           throws IOException
Overrides:
reset in class InputStream
Throws:
IOException