3.0.4: 2012-03-05

net.sf.basedb.util.uri
Class CloseResourceInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by net.sf.basedb.util.uri.CloseResourceInputStream
All Implemented Interfaces:
Closeable

public class CloseResourceInputStream
extends FilterInputStream

Inputstream filter that closes a given resource whenever the parent input stream is closed.

Since:
3.0
Author:
Nicklas
Last modified
$Date: 2011-03-15 13:55:59 +0100 (Tue, 15 Mar 2011) $

Field Summary
private  Closeable resource
           
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
CloseResourceInputStream(InputStream parent, Closeable resource)
          Create a new stream.
 
Method Summary
 void close()
          Make sure the client connection manager is closed when the file has been completely downloaded.
 
Methods inherited from class java.io.FilterInputStream
available, mark, markSupported, read, read, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

resource

private final Closeable resource
Constructor Detail

CloseResourceInputStream

public CloseResourceInputStream(InputStream parent,
                                Closeable resource)
Create a new stream.

Parameters:
parent - The parent input stream
resource - The resource to close when the close() method is called.
Method Detail

close

public void close()
           throws IOException
Make sure the client connection manager is closed when the file has been completely downloaded.

Specified by:
close in interface Closeable
Overrides:
close in class FilterInputStream
Throws:
IOException

3.0.4: 2012-03-05