Package com.unboundid.util
Class NullOutputStream
java.lang.Object
java.io.OutputStream
com.unboundid.util.NullOutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
@NotMutable
@ThreadSafety(level=COMPLETELY_THREADSAFE)
public final class NullOutputStream
extends OutputStream
This class provides an implementation of a
java.io.OutputStream in
which any data written to it is simply discarded.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes this output stream.voidflush()Flushes the contents of this output stream.static NullOutputStreamRetrieves an instance of this null output stream.static PrintStreamRetrieves a print stream based on this null output stream.voidwrite(byte[] b) Writes the contents of the provided byte array over this output stream.voidwrite(byte[] b, int off, int len) Writes the contents of the provided byte array over this output stream.voidwrite(int b) Writes the provided byte over this input stream.Methods inherited from class java.io.OutputStream
nullOutputStream
-
Constructor Details
-
NullOutputStream
public NullOutputStream()Creates a new null output stream instance.
-
-
Method Details
-
getInstance
Retrieves an instance of this null output stream.- Returns:
- An instance of this null output stream.
-
getPrintStream
Retrieves a print stream based on this null output stream.- Returns:
- A print stream based on this null output stream.
-
close
Closes this output stream. This has no effect.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream
-
flush
Flushes the contents of this output stream. This has no effect.- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream
-
write
Writes the contents of the provided byte array over this output stream. This has no effect.- Overrides:
writein classOutputStream- Parameters:
b- The byte array containing the data to be written.
-
write
Writes the contents of the provided byte array over this output stream. This has no effect.- Overrides:
writein classOutputStream- Parameters:
b- The byte array containing the data to be written.off- The position in the array at which to start writing data.len- The number of bytes to be written.
-
write
Writes the provided byte over this input stream. This has no effect.- Specified by:
writein classOutputStream- Parameters:
b- The byte to be written.
-