org.entityfs.support.io
Class OutputStreamProxy

java.lang.Object
  extended by java.io.OutputStream
      extended by org.entityfs.support.io.OutputStreamProxy
All Implemented Interfaces:
Closeable, Flushable
Direct Known Subclasses:
Base64OutputStream, CountingOutputStream, LockAwareOutputStream

public abstract class OutputStreamProxy
extends OutputStream

This is an abstract proxy implementation for wrapping an OutputStream in a proxy object. The orthodox way to do the same would be to let the wrapping class inherit FilterOutputStream, but that turned out to be a real performance hog.

Subclasses inherit this class and override methods as needed.

This would really be easier if OutputStream had been an interface...

Since:
1.0
Author:
Karl Gustafsson
See Also:
InputStreamProxy

Constructor Summary
protected OutputStreamProxy(OutputStream os)
          Create an output stream proxy
 
Method Summary
 void close()
           
 void flush()
           
protected  OutputStream getProxied()
          Get the proxied stream.
 String toString()
           
 void write(byte[] b)
           
 void write(byte[] b, int off, int len)
           
 void write(int b)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OutputStreamProxy

protected OutputStreamProxy(OutputStream os)
Create an output stream proxy

Parameters:
os - The proxied stream
Method Detail

getProxied

protected OutputStream getProxied()
Get the proxied stream.

Returns:
The proxied stream.

close

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

flush

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

write

public void write(byte[] b)
           throws IOException
Overrides:
write in class OutputStream
Throws:
IOException

write

public void write(byte[] b,
                  int off,
                  int len)
           throws IOException
Overrides:
write in class OutputStream
Throws:
IOException

write

public void write(int b)
           throws IOException
Specified by:
write in class OutputStream
Throws:
IOException

toString

public String toString()
Overrides:
toString in class Object