Package it.unimi.dsi.io
Class NullOutputStream
java.lang.Object
java.io.OutputStream
it.unimi.dsi.io.NullOutputStream
- All Implemented Interfaces:
RepositionableStream
,Closeable
,Flushable
,AutoCloseable
Throw-it-away output stream.
This stream discards whatever is written into it. Its usefulness is in
previewing the length of some coding by wrapping it in an OutputBitStream
(it is a good idea, in this case, to specify a 0-length buffer).
This class is a singleton. You cannot create a null output stream,
but you can obtain an instance of this class using getInstance()
.
- Since:
- 0.6
- Author:
- Sebastiano Vigna
-
Method Summary
Modifier and TypeMethodDescriptionstatic NullOutputStream
Returns the only instance of this class.long
position()
void
position
(long newPosition) void
write
(int discarded) Methods inherited from class java.io.OutputStream
close, flush, nullOutputStream, write, write
-
Method Details
-
write
public void write(int discarded) - Specified by:
write
in classOutputStream
-
getInstance
Returns the only instance of this class. -
position
- Specified by:
position
in interfaceRepositionableStream
- Throws:
IOException
-
position
- Specified by:
position
in interfaceRepositionableStream
- Throws:
IOException
-