Package org.apache.commons.io.output

# Class NullOutputStream

java.lang.Object
java.io.OutputStream
org.apache.commons.io.output.NullOutputStream

All Implemented Interfaces:
  `Closeable`, `Flushable`, `AutoCloseable`

public class NullOutputStream extends OutputStream
Never writes data. Calls never go beyond this class.

This output stream has no destination (file/socket etc.) and all bytes written to it are ignored and lost.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final NullOutputStream`
  `INSTANCE`
  The singleton instance.
  `static final NullOutputStream`
  `NULL_OUTPUT_STREAM`
  Deprecated.
  Use `INSTANCE`.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `NullOutputStream()`
  Deprecated.
  Use `INSTANCE`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `write(byte[] b)`
  Does nothing - output to `/dev/null`.
  `void`
  `write(byte[] b, int off, int len)`
  Does nothing - output to `/dev/null`.
  `void`
  `write(int b)`
  Does nothing - output to `/dev/null`.

  ### Methods inherited from class java.io.OutputStream

  `close, flush`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### INSTANCE

    public static final NullOutputStream INSTANCE
    The singleton instance.
    Since:
      2.12.0

  - ### NULL_OUTPUT_STREAM

    @Deprecated public static final NullOutputStream NULL_OUTPUT_STREAM
    Deprecated.
    Use `INSTANCE`.
    The singleton instance.

- ## Constructor Details

  - ### NullOutputStream

    @Deprecated public NullOutputStream()
    Deprecated.
    Use `INSTANCE`.
    Deprecated in favor of `INSTANCE`. TODO: Will be private in 3.0.

- ## Method Details

  - ### write

    public void write(byte[] b) throws IOException
    Does nothing - output to `/dev/null`.
    Overrides:
      `write` in class `OutputStream`
    Parameters:
      `b` - The bytes to write
    Throws:
      `IOException` - never

  - ### write

    public void write(byte[] b, int off, int len)
    Does nothing - output to `/dev/null`.
    Overrides:
      `write` in class `OutputStream`
    Parameters:
      `b` - The bytes to write
      `off` - The start offset
      `len` - The number of bytes to write

  - ### write

    public void write(int b)
    Does nothing - output to `/dev/null`.
    Specified by:
      `write` in class `OutputStream`
    Parameters:
      `b` - The byte to write