edu.rice.cs.plt.io
Class WrappedDirectOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by edu.rice.cs.plt.io.DirectOutputStream
          extended by edu.rice.cs.plt.io.WrappedDirectOutputStream
All Implemented Interfaces:
Composite, java.io.Closeable, java.io.Flushable

public class WrappedDirectOutputStream
extends DirectOutputStream
implements Composite

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


Field Summary
 
Fields inherited from class edu.rice.cs.plt.io.DirectOutputStream
DEFAULT_BUFFER_SIZE
 
Constructor Summary
WrappedDirectOutputStream(java.io.OutputStream stream)
           
 
Method Summary
 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.
 void flush()
           
static DirectOutputStream makeDirect(java.io.OutputStream stream)
          If the input is a DirectOutputStream, cast it; otherwise, create a WrappedDirectOutputStream.
 void write(byte[] bbuf)
          Delegate to the more general DirectOutputStream.write(byte[], int, int) method
 void write(byte[] bbuf, int offset, int length)
          Subclasses are, at a minimum, required to implement this method.
 void write(int b)
          Delegate to the more general DirectOutputStream.write(byte[], int, int) method
 
Methods inherited from class edu.rice.cs.plt.io.DirectOutputStream
write, write, write, writeAll, writeAll, writeAll
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WrappedDirectOutputStream

public WrappedDirectOutputStream(java.io.OutputStream 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

close

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

flush

public void flush()
           throws java.io.IOException
Specified by:
flush in interface java.io.Flushable
Overrides:
flush in class java.io.OutputStream
Throws:
java.io.IOException

write

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

Overrides:
write in class DirectOutputStream
Throws:
java.io.IOException

write

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

Overrides:
write in class DirectOutputStream
Throws:
java.io.IOException

write

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

Specified by:
write in class DirectOutputStream
Throws:
java.io.IOException

makeDirect

public static DirectOutputStream makeDirect(java.io.OutputStream stream)
If the input is a DirectOutputStream, cast it; otherwise, create a WrappedDirectOutputStream.