org.das2.util
Class ByteBufferInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by org.das2.util.ByteBufferInputStream
All Implemented Interfaces:
java.io.Closeable

public class ByteBufferInputStream
extends java.io.InputStream

An input stream that wraps an NIO ByteBuffer. Reading from this stream will update the ByteBuffers position. Calling mark() on this input stream will set the mark on the underlying buffer.


Constructor Summary
ByteBufferInputStream(java.nio.ByteBuffer buffer)
          Creates a new instance of ByteBufferInputStream
 
Method Summary
 int available()
           
 void close()
           
 java.nio.ByteBuffer getByteBuffer()
           
 void mark(int readlimit)
           
 boolean markSupported()
           
 int read()
           
 int read(byte[] b)
           
 int read(byte[] b, int off, int len)
           
 void reset()
           
 long skip(long n)
           
 
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 buffer)
Creates a new instance of ByteBufferInputStream

Method Detail

getByteBuffer

public java.nio.ByteBuffer getByteBuffer()

read

public int read()
Specified by:
read in class java.io.InputStream

close

public void close()
Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.InputStream

skip

public long skip(long n)
Overrides:
skip in class java.io.InputStream

reset

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

available

public int available()
Overrides:
available in class java.io.InputStream

read

public int read(byte[] b)
Overrides:
read in class java.io.InputStream

markSupported

public boolean markSupported()
Overrides:
markSupported in class java.io.InputStream

mark

public void mark(int readlimit)
Overrides:
mark in class java.io.InputStream

read

public int read(byte[] b,
                int off,
                int len)
Overrides:
read in class java.io.InputStream