org.apache.commons.io.output
Class NullWriter

java.lang.Object
  extended by java.io.Writer
      extended by org.apache.commons.io.output.NullWriter
All Implemented Interfaces:
Closeable, Flushable, Appendable

public class NullWriter
extends Writer

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

This Writer has no destination (file/socket etc.) and all characters written to it are ignored and lost.

Version:
$Id: NullWriter.java 610010 2008-01-08 14:50:59Z niallp $

Field Summary
static NullWriter NULL_WRITER
          A singleton.
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
NullWriter()
          Constructs a new NullWriter.
 
Method Summary
 void close()
           
 void flush()
           
 void write(char[] chr)
          Does nothing - output to /dev/null.
 void write(char[] chr, int st, int end)
          Does nothing - output to /dev/null.
 void write(int idx)
          Does nothing - output to /dev/null.
 void write(String str)
          Does nothing - output to /dev/null.
 void write(String str, int st, int end)
          Does nothing - output to /dev/null.
 
Methods inherited from class java.io.Writer
append, append, append, append, append, append
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NULL_WRITER

public static final NullWriter NULL_WRITER
A singleton.

Constructor Detail

NullWriter

public NullWriter()
Constructs a new NullWriter.

Method Detail

write

public void write(int idx)
Does nothing - output to /dev/null.

Overrides:
write in class Writer
Parameters:
idx - The character to write

write

public void write(char[] chr)
Does nothing - output to /dev/null.

Overrides:
write in class Writer
Parameters:
chr - The characters to write

write

public void write(char[] chr,
                  int st,
                  int end)
Does nothing - output to /dev/null.

Specified by:
write in class Writer
Parameters:
chr - The characters to write
st - The start offset
end - The number of characters to write

write

public void write(String str)
Does nothing - output to /dev/null.

Overrides:
write in class Writer
Parameters:
str - The string to write

write

public void write(String str,
                  int st,
                  int end)
Does nothing - output to /dev/null.

Overrides:
write in class Writer
Parameters:
str - The string to write
st - The start offset
end - The number of characters to write

flush

public void flush()
Specified by:
flush in interface Flushable
Specified by:
flush in class Writer
See Also:
Writer.flush()

close

public void close()
Specified by:
close in interface Closeable
Specified by:
close in class Writer
See Also:
Writer.close()


Copyright © 2002-2008 The Apache Software Foundation. All Rights Reserved.