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
FieldsModifier and TypeFieldDescriptionstatic final ClosedInputStreamDeprecated.static final ClosedInputStreamThe singleton instance. -
Constructor Summary
Constructors -
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()Construct a new instance.
-
-
Method Details
-
read
Returns -1 to indicate that the stream is closed.- Specified by:
readin classInputStream- Returns:
- always -1
-
read
Returns -1 to indicate that the stream is closed.- Overrides:
readin classInputStream- Parameters:
b- ignored.off- ignored.len- ignored.- Returns:
- always -1
- Throws:
IOException
-
INSTANCE.