NullOutputStream (Commons IO 2.5)
Date: 2016-12-01

org.apache.commons.io.output

## Class NullOutputStream

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

- All Implemented Interfaces:
    java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable

      public class NullOutputStream
      extends java.io.OutputStream

  This OutputStream writes all data to the famous /dev/null.

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

  Version:
    $Id: NullOutputStream.java 1674708 2015-04-20 00:02:45Z ggregory $

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static NullOutputStream` | `NULL_OUTPUT_STREAM` A singleton.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `NullOutputStream()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and 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 Detail

    - #### NULL_OUTPUT_STREAM

          public static final NullOutputStream NULL_OUTPUT_STREAM

      A singleton.

  - ### Constructor Detail

    - #### NullOutputStream

          public NullOutputStream()

  - ### Method Detail

    - #### write

          public void write(byte[] b,
                   int off,
                   int len)

      Does nothing - output to `/dev/null`.
      Overrides:
        `write` in class `java.io.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 `java.io.OutputStream`
      Parameters:
        `b` - The byte to write

    - #### write

          public void write(byte[] b)
                     throws java.io.IOException

      Does nothing - output to `/dev/null`.
      Overrides:
        `write` in class `java.io.OutputStream`
      Parameters:
        `b` - The bytes to write
      Throws:
        `java.io.IOException` - never

Copyright (c) 2002-2016 Apache Software Foundation