Class NullOutputStream

java.lang.Object
java.io.OutputStream
com.unboundid.util.NullOutputStream
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable

This class provides an implementation of a java.io.OutputStream in which any data written to it is simply discarded.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new null output stream instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Closes this output stream.
    void
    Flushes the contents of this output stream.
    Retrieves an instance of this null output stream.
    Retrieves a print stream based on this null output stream.
    void
    write(byte[] b)
    Writes the contents of the provided byte array over this output stream.
    void
    write(byte[] b, int off, int len)
    Writes the contents of the provided byte array over this output stream.
    void
    write(int b)
    Writes the provided byte over this input stream.

    Methods inherited from class java.io.OutputStream

    nullOutputStream

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • 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

      public void close()
      Closes this output stream. This has no effect.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class OutputStream
    • flush

      public void flush()
      Flushes the contents of this output stream. This has no effect.
      Specified by:
      flush in interface Flushable
      Overrides:
      flush in class OutputStream
    • write

      public void write(@NotNull byte[] b)
      Writes the contents of the provided byte array over this output stream. This has no effect.
      Overrides:
      write in class OutputStream
      Parameters:
      b - The byte array containing the data to be written.
    • write

      public void write(@NotNull byte[] b, int off, int len)
      Writes the contents of the provided byte array over this output stream. This has no effect.
      Overrides:
      write in class OutputStream
      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

      public void write(int b)
      Writes the provided byte over this input stream. This has no effect.
      Specified by:
      write in class OutputStream
      Parameters:
      b - The byte to be written.