public class ClosedReader
extends java.io.Reader
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.
Modifier and Type | Field and Description |
---|---|
static ClosedReader |
CLOSED_READER
A singleton.
|
Constructor and Description |
---|
ClosedReader() |
Modifier and Type | Method and Description |
---|---|
void |
close() |
int |
read(char[] cbuf,
int off,
int len)
Returns -1 to indicate that the stream is closed.
|
public static final ClosedReader CLOSED_READER
public int read(char[] cbuf, int off, int len)
read
in class java.io.Reader
cbuf
- ignoredoff
- ignoredlen
- ignoredpublic void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.Reader
java.io.IOException