org.xerial.util.io
Class NullOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by org.xerial.util.io.NullOutputStream
All Implemented Interfaces:
Closeable, Flushable

public class NullOutputStream
extends OutputStream

The usage of NullOutputStream is to switch on/off of message outputs without modifying or commenting out println(...) methods. For example,

        
 PrintStream log = new PrintStream(System.out); // output messages to be displayed to std. out
 // PrintStream log = new PrintStream(new NullOutputStream());  // no output will be generated
 
 log.println("some messages");
 
 

Author:
leo

Constructor Summary
NullOutputStream()
           
 
Method Summary
 void close()
           
 void flush()
           
 void write(byte[] arg0)
           
 void write(byte[] arg0, int arg1, int arg2)
           
 void write(int c)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NullOutputStream

public NullOutputStream()
Method Detail

write

public void write(int c)
           throws IOException
Specified by:
write in class OutputStream
Throws:
IOException

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Overrides:
close in class OutputStream
Throws:
IOException

flush

public void flush()
           throws IOException
Specified by:
flush in interface Flushable
Overrides:
flush in class OutputStream
Throws:
IOException

write

public void write(byte[] arg0,
                  int arg1,
                  int arg2)
           throws IOException
Overrides:
write in class OutputStream
Throws:
IOException

write

public void write(byte[] arg0)
           throws IOException
Overrides:
write in class OutputStream
Throws:
IOException


Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 2.1 Japan License.