Package it.unimi.dsi.io
Class NullReader
- java.lang.Object
-
- java.io.Reader
-
- it.unimi.dsi.io.NullReader
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Serializable,java.lang.AutoCloseable,java.lang.Readable
public class NullReader extends java.io.Reader implements java.io.SerializableEnd-of-stream-only reader.This reader will always return end-of-file on any read attempt.
This class is a singleton. You cannot create a null reader, but you can obtain an instance of this class using
getInstance().- Since:
- 0.9.2
- Author:
- Sebastiano Vigna
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()static NullReadergetInstance()Returns the only instance of this class.intread(char[] cbuf, int off, int len)
-
-
-
Method Detail
-
getInstance
public static NullReader getInstance()
Returns the only instance of this class.- Returns:
- the only instance of this class.
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein classjava.io.Reader
-
read
public int read(char[] cbuf, int off, int len)- Specified by:
readin classjava.io.Reader
-
-