Class NullOutputStream

java.lang.Object
java.io.OutputStream
org.apache.tools.ant.util.NullOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable

public class NullOutputStream
extends java.io.OutputStream
OutputStream that completely discards all data written to it.
Since:
Ant 1.10.10
  • Field Summary

    Fields 
    Modifier and Type Field Description
    static NullOutputStream INSTANCE
    Shared instance which is safe to use concurrently as the stream doesn't hold any state at all.
  • Method Summary

    Modifier and Type Method Description
    void write​(byte[] b)
    Doesn't do anything.
    void write​(byte[] b, int off, int len)
    Doesn't do anything.
    void write​(int i)
    Doesn't do anything.

    Methods inherited from class java.io.OutputStream

    close, flush, nullOutputStream

    Methods inherited from class java.lang.Object

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

    • INSTANCE

      public static NullOutputStream INSTANCE
      Shared instance which is safe to use concurrently as the stream doesn't hold any state at all.
  • Method Details

    • write

      public void write​(byte[] b)
      Doesn't do anything.
      Overrides:
      write in class java.io.OutputStream
    • write

      public void write​(byte[] b, int off, int len)
      Doesn't do anything.
      Overrides:
      write in class java.io.OutputStream
    • write

      public void write​(int i)
      Doesn't do anything.
      Specified by:
      write in class java.io.OutputStream