Package it.unimi.dsi.io
Class NullInputStream
java.lang.Object
java.io.InputStream
it.unimi.dsi.fastutil.io.MeasurableInputStream
it.unimi.dsi.io.NullInputStream
- All Implemented Interfaces:
MeasurableStream
,RepositionableStream
,Closeable
,Serializable
,AutoCloseable
public class NullInputStream extends MeasurableInputStream implements RepositionableStream, Serializable
End-of-stream-only input stream.
This stream has length 0, and will always return end-of-file on any read attempt.
This class is a singleton. You cannot create a null input stream,
but you can obtain an instance of this class using getInstance()
.
- Since:
- 0.8
- Author:
- Sebastiano Vigna
- See Also:
- Serialized Form
-
Method Summary
Modifier and Type Method Description static NullInputStream
getInstance()
Returns the only instance of this class.long
length()
long
position()
void
position(long position)
int
read()
Methods inherited from class java.io.InputStream
available, close, mark, markSupported, nullInputStream, read, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
-
Method Details
-
read
public int read()- Specified by:
read
in classInputStream
-
getInstance
Returns the only instance of this class.- Returns:
- the only instance of this class.
-
length
public long length()- Specified by:
length
in interfaceMeasurableStream
-
position
public long position()- Specified by:
position
in interfaceMeasurableStream
- Specified by:
position
in interfaceRepositionableStream
-
position
- Specified by:
position
in interfaceRepositionableStream
- Throws:
IOException
-