de.netseeker.ejoe.io
Class ByteBufferInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by de.netseeker.ejoe.io.ByteBufferInputStream
All Implemented Interfaces:
java.io.Closeable

public class ByteBufferInputStream
extends java.io.InputStream

Implements an input stream over a NIO ByteBuffer. The ByteBuffer is replacable, and is supplied by an external source. This class is based on an article found at the homepage of Michael W. Spille.

Author:
Michael W. Spille, netseeker aka Michael Manske

Constructor Summary
ByteBufferInputStream(java.nio.ByteBuffer buffer)
          Constructs a new ByteBufferInputStream which reads from specified buffer
 
Method Summary
 int available()
           
 void close()
           
 boolean markSupported()
           
 int read()
           
 int read(byte[] b)
           
 int read(byte[] b, int offset, int length)
           
 void setByteBuffer(java.nio.ByteBuffer buffer)
           
 
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 buffer)
Constructs a new ByteBufferInputStream which reads from specified buffer

Method Detail

setByteBuffer

public void setByteBuffer(java.nio.ByteBuffer buffer)
Parameters:
buffer -

available

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

close

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

markSupported

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

read

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

read

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

read

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


Copyright © 2005-2007 netseeker. All Rights Reserved.