org.entityfs.support.io
Class InputStreamProxy

java.lang.Object
  extended by java.io.InputStream
      extended by org.entityfs.support.io.InputStreamProxy
All Implemented Interfaces:
Closeable
Direct Known Subclasses:
Base64InputStream, ChecksumInputStream, CountingInputStream, LockAwareInputStream

public class InputStreamProxy
extends InputStream

This is an abstract proxy implementation for wrapping an InputStream in a proxy object. The orthodox way to do the same would be to let the wrapping class inherit FilterInputStream, 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 InputStream had been an interface...

Since:
1.0
Author:
Karl Gustafsson
See Also:
OutputStreamProxy

Constructor Summary
protected InputStreamProxy(InputStream proxied)
           
 
Method Summary
 int available()
          This returns the number of bytes available in the proxied stream.
 void close()
           
protected  InputStream getProxied()
           
 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)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InputStreamProxy

protected InputStreamProxy(InputStream proxied)
Method Detail

getProxied

protected InputStream getProxied()

available

public int available()
              throws IOException
This returns the number of bytes available in the proxied stream. Subclasses that do some kind of transformation on the data in the proxied stream will probably have to override this.

Overrides:
available in class InputStream
Throws:
IOException

close

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

mark

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

markSupported

public boolean markSupported()
Overrides:
markSupported in class InputStream

read

public int read()
         throws IOException
Specified by:
read in class InputStream
Throws:
IOException

read

public int read(byte[] b)
         throws IOException
Overrides:
read in class InputStream
Throws:
IOException

read

public int read(byte[] b,
                int off,
                int len)
         throws IOException
Overrides:
read in class InputStream
Throws:
IOException

reset

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

skip

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

toString

public String toString()
Overrides:
toString in class Object