Package net.dona.doip.client
Class DelegatedCloseableInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
net.dona.doip.client.DelegatedCloseableInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
An input stream which will run a supplied runnable when the input stream is closed.
-
Field Summary
Fields inherited from class java.io.FilterInputStream
in
-
Constructor Summary
ConstructorsConstructorDescriptionDelegatedCloseableInputStream
(InputStream in, Runnable closeFunction) Constructs an input stream which wraps the supplied input stream and runs the supplied runnable when the input stream is closed. -
Method Summary
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
-
Constructor Details
-
DelegatedCloseableInputStream
Constructs an input stream which wraps the supplied input stream and runs the supplied runnable when the input stream is closed.- Parameters:
in
- the input stream to wrapcloseFunction
- the runnable to run when the input stream is closed
-
-
Method Details
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classFilterInputStream
- Throws:
IOException
-