Package org.opends.server.types
Class NullOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- org.opends.server.types.NullOutputStream
-
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
@PublicAPI(stability=UNCOMMITTED, mayInstantiate=true, mayExtend=false, mayInvoke=true) public final class NullOutputStream extends OutputStream
This class defines a custom output stream that simply discards any data written to it.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the output stream.voidflush()Flushes the output stream.static NullOutputStreaminstance()Retrieves an instance of this null output stream.static PrintStreamnullPrintStream()Retrieves a print stream using this null output stream.static PrintStreamwrapOrNullStream(OutputStream s)Returns s wrapped into aPrintStreamif is not null,nullPrintStream()otherwise.voidwrite(byte[] b)Writes the provided data to this output stream.voidwrite(byte[] b, int off, int len)Writes the provided data to this output stream.voidwrite(int b)Writes the provided byte to this output stream.-
Methods inherited from class java.io.OutputStream
nullOutputStream
-
-
-
-
Method Detail
-
instance
public static NullOutputStream instance()
Retrieves an instance of this null output stream.- Returns:
- An instance of this null output stream.
-
nullPrintStream
public static PrintStream nullPrintStream()
Retrieves a print stream using this null output stream.- Returns:
- A print stream using this null output stream.
-
wrapOrNullStream
public static PrintStream wrapOrNullStream(OutputStream s)
Returns s wrapped into aPrintStreamif is not null,nullPrintStream()otherwise.- Parameters:
s- the OutputStream to wrap into aPrintStream. Can be null.- Returns:
- a PrintStream wrapping s if not null,
nullPrintStream()otherwise.
-
close
public void close()
Closes the output stream. This has no effect.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream
-
flush
public void flush()
Flushes the output stream. This has no effect.- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream
-
write
public void write(byte[] b)
Writes the provided data to this output stream. This has no effect.- Overrides:
writein classOutputStream- Parameters:
b- The byte array containing the data to be written.
-
write
public void write(byte[] b, int off, int len)Writes the provided data to this output stream. This has no effect.- Overrides:
writein classOutputStream- Parameters:
b- The byte array containing the data to be written.off- The offset at which the real data begins.len- The number of bytes to be written.
-
write
public void write(int b)
Writes the provided byte to this output stream. This has no effect.- Specified by:
writein classOutputStream- Parameters:
b- The byte to be written.
-
-