Package org.apache.commons.io.input
Class ClosedReader
- java.lang.Object
 - 
- java.io.Reader
 - 
- org.apache.commons.io.input.ClosedReader
 
 
 
- 
- All Implemented Interfaces:
 java.io.Closeable,java.lang.AutoCloseable,java.lang.Readable
public class ClosedReader extends java.io.ReaderAlways returnsIOUtils.EOFto 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
nullreader.- Since:
 - 2.7
 
 
- 
- 
Field Summary
Fields Modifier and Type Field Description static ClosedReaderCLOSED_READERDeprecated.static ClosedReaderINSTANCEThe singleton instance. 
- 
Constructor Summary
Constructors Constructor Description ClosedReader() 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()intread(char[] cbuf, int off, int len)Returns -1 to indicate that the stream is closed. 
 - 
 
- 
- 
Field Detail
- 
INSTANCE
public static final ClosedReader INSTANCE
The singleton instance.- Since:
 - 2.12.0
 
 
- 
CLOSED_READER
@Deprecated public static final ClosedReader CLOSED_READER
Deprecated.The singleton instance. 
 - 
 
- 
Method Detail
- 
close
public void close() throws java.io.IOException- Specified by:
 closein interfacejava.lang.AutoCloseable- Specified by:
 closein interfacejava.io.Closeable- Specified by:
 closein classjava.io.Reader- Throws:
 java.io.IOException
 
- 
read
public int read(char[] cbuf, int off, int len)Returns -1 to indicate that the stream is closed.- Specified by:
 readin classjava.io.Reader- Parameters:
 cbuf- ignoredoff- ignoredlen- ignored- Returns:
 - always -1
 
 
 - 
 
 -