Package net.sf.basedb.util.uri
Class CloseResourceInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
net.sf.basedb.util.uri.CloseResourceInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
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 (ti, 15 mar 2011) $
-
Field Summary
Fields inherited from class java.io.FilterInputStream
in
-
Constructor Summary
Constructors Constructor Description CloseResourceInputStream(InputStream parent, Closeable resource)
Create a new stream. -
Method Summary
Modifier and Type Method Description 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.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Field Details
-
resource
-
-
Constructor Details
-
CloseResourceInputStream
Create a new stream.- Parameters:
parent
- The parent input streamresource
- The resource to close when theclose()
method is called.
-
-
Method Details
-
close
Make sure the client connection manager is closed when the file has been completely downloaded.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classFilterInputStream
- Throws:
IOException
-