Class MCRNotClosingInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
org.mycore.common.content.streams.MCRNotClosingInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
A FilterInputStream that wraps any InputStream to prevent close() is called.
Sometimes, third party code or code you can not change closes an InputStream after
it returned -1 on read(). But when using ZipInputStream, this is unwanted, because
a ZipInputStream may contain other entries that have to be read and invoked code
must be prevented from calling close(). With this class, a ZipInputStream or any other
stream can be wrapped to regain control of closing.
- Author:
- Frank Lützenkirchen
-
Field Summary
Fields inherited from class java.io.FilterInputStream
in
-
Constructor Summary
-
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
-
MCRNotClosingInputStream
-
-
Method Details
-
close
Does nothing. When you want to really close the stream, call reallyClose().- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classFilterInputStream
- Throws:
IOException
-
reallyClose
Really closes the stream.- Throws:
IOException
-