Package org.apache.commons.io.input
Class ClosedReader
java.lang.Object
java.io.Reader
org.apache.commons.io.input.ClosedReader
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Readable
Closed reader. This reader returns EOF to all attempts to read something from it.
Typically uses of this class include testing for corner cases in methods that accept readers and acting as a sentinel
value instead of a null
reader.
- Since:
- 2.7
-
Field Details
-
CLOSED_READER
A singleton.
-
-
Constructor Details
-
ClosedReader
public ClosedReader()
-
-
Method Details
-
read
public int read(char[] cbuf, int off, int len) Returns -1 to indicate that the stream is closed. -
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in classReader
- Throws:
IOException
-