Package org.apache.commons.io.input
Class ClosedInputStream
java.lang.Object
java.io.InputStream
org.apache.commons.io.input.ClosedInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
Always returns
IOUtils.EOF
to all attempts to read something from an input stream.
Typically uses of this class include testing for corner cases in methods that accept input streams and acting as a
sentinel value instead of a null
input stream.
- Since:
- 1.4
-
Field Summary
Modifier and TypeFieldDescriptionstatic final ClosedInputStream
Deprecated.static final ClosedInputStream
The singleton instance. -
Constructor Summary
-
Method Summary
Methods inherited from class java.io.InputStream
available, close, mark, markSupported, read, reset, skip
-
Field Details
-
INSTANCE
The singleton instance.- Since:
- 2.12.0
-
CLOSED_INPUT_STREAM
Deprecated.UseINSTANCE
.The singleton instance.
-
-
Constructor Details
-
ClosedInputStream
public ClosedInputStream()
-
-
Method Details
-
read
Returns -1 to indicate that the stream is closed.- Specified by:
read
in classInputStream
- Returns:
- always -1
-
read
Returns -1 to indicate that the stream is closed.- Overrides:
read
in classInputStream
- Parameters:
b
- ignored.off
- ignored.len
- ignored.- Returns:
- always -1
- Throws:
IOException
-
INSTANCE
.