to.etc.util
Class WrappedDatabaseInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by to.etc.util.WrappedDatabaseInputStream
All Implemented Interfaces:
java.io.Closeable

public class WrappedDatabaseInputStream
extends java.io.InputStream

An input stream which encapsulates the database resources it is derived from, to allow returning BLOB streams safely. When the stream is closed it also closes all database resources.

Author:
Frits Jalvingh Created on Nov 25, 2010

Constructor Summary
WrappedDatabaseInputStream(java.sql.Connection dbc, java.sql.Statement st, java.sql.ResultSet rs, java.io.InputStream is)
           
 
Method Summary
 int available()
           
 void close()
           
 void mark(int readlimit)
          Despite the Eclipse warning: do NOT add synchronized - it is wrong.
 boolean markSupported()
           
 int read()
           
 int read(byte[] b)
           
 int read(byte[] b, int off, int len)
           
 void reset()
          Despite the Eclipse warning: do NOT add synchronized - it is wrong.
 long skip(long n)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WrappedDatabaseInputStream

public WrappedDatabaseInputStream(java.sql.Connection dbc,
                                  java.sql.Statement st,
                                  java.sql.ResultSet rs,
                                  java.io.InputStream is)
Method Detail

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 readlimit)
Despite the Eclipse warning: do NOT add synchronized - it is wrong.

Overrides:
mark in class java.io.InputStream
See Also:
InputStream.mark(int)

markSupported

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

read

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

read

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

reset

public void reset()
           throws java.io.IOException
Despite the Eclipse warning: do NOT add synchronized - it is wrong.

Overrides:
reset in class java.io.InputStream
Throws:
java.io.IOException
See Also:
InputStream.reset()

skip

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

read

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