edu.rice.cs.plt.io
Class WrappedDirectInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by edu.rice.cs.plt.io.DirectInputStream
          extended by edu.rice.cs.plt.io.WrappedDirectInputStream
All Implemented Interfaces:
Composite, java.io.Closeable

public class WrappedDirectInputStream
extends DirectInputStream
implements Composite

An implementation of DirectInputStream that inherits that class's default implementations and delegates all other operations to the wrapped InputStream.


Field Summary
 
Fields inherited from class edu.rice.cs.plt.io.DirectInputStream
DEFAULT_BUFFER_SIZE
 
Constructor Summary
WrappedDirectInputStream(java.io.InputStream stream)
           
 
Method Summary
 int available()
           
 void close()
           
 int compositeHeight()
          Get the maximum path length from this node to a leaf.
 int compositeSize()
          Get the number of nodes in the tree rooted at this node.
static DirectInputStream makeDirect(java.io.InputStream stream)
          If the input is a DirectInputStream, cast it; otherwise, create a WrappedDirectInputStream.
 void mark(int readAheadLimit)
           
 boolean markSupported()
           
 int read()
          Delegate to the more general DirectInputStream.read(byte[], int, int) method
 int read(byte[] bbuf)
          Delegate to the more general DirectInputStream.read(byte[], int, int) method
 int read(byte[] bbuf, int offset, int length)
          Subclasses are, at a minimum, required to implement this method.
 void reset()
           
 long skip(long n)
           
 
Methods inherited from class edu.rice.cs.plt.io.DirectInputStream
read, read, read, readAll, readAll, readAll
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WrappedDirectInputStream

public WrappedDirectInputStream(java.io.InputStream stream)
Method Detail

compositeHeight

public int compositeHeight()
Description copied from interface: Composite
Get the maximum path length from this node to a leaf.

Specified by:
compositeHeight in interface Composite

compositeSize

public int compositeSize()
Description copied from interface: Composite
Get the number of nodes in the tree rooted at this node. Always 1 or greater.

Specified by:
compositeSize in interface Composite

available

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

close

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

mark

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

markSupported

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

read

public int read()
         throws java.io.IOException
Description copied from class: DirectInputStream
Delegate to the more general DirectInputStream.read(byte[], int, int) method

Overrides:
read in class DirectInputStream
Throws:
java.io.IOException

read

public int read(byte[] bbuf)
         throws java.io.IOException
Description copied from class: DirectInputStream
Delegate to the more general DirectInputStream.read(byte[], int, int) method

Overrides:
read in class DirectInputStream
Throws:
java.io.IOException

read

public int read(byte[] bbuf,
                int offset,
                int length)
         throws java.io.IOException
Description copied from class: DirectInputStream
Subclasses are, at a minimum, required to implement this method.

Specified by:
read in class DirectInputStream
Throws:
java.io.IOException

reset

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

skip

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

makeDirect

public static DirectInputStream makeDirect(java.io.InputStream stream)
If the input is a DirectInputStream, cast it; otherwise, create a WrappedDirectInputStream.