Package org.apache.commons.io.output
Class NullWriter
- java.lang.Object
-
- java.io.Writer
-
- org.apache.commons.io.output.NullWriter
-
- All Implemented Interfaces:
Closeable,Flushable,Appendable,AutoCloseable
public class NullWriter extends Writer
Writes all data to the famous /dev/null.This
Writerhas no destination (file/socket etc.) and all characters written to it are ignored and lost.
-
-
Field Summary
Fields Modifier and Type Field Description static NullWriterNULL_WRITERA singleton.
-
Constructor Summary
Constructors Constructor Description NullWriter()Constructs a new NullWriter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Writerappend(char c)Does nothing - output to/dev/null.Writerappend(CharSequence csq)Does nothing - output to/dev/null.Writerappend(CharSequence csq, int start, int end)Does nothing - output to/dev/null.voidclose()voidflush()voidwrite(char[] chr)Does nothing - output to/dev/null.voidwrite(char[] chr, int st, int end)Does nothing - output to/dev/null.voidwrite(int idx)Does nothing - output to/dev/null.voidwrite(String str)Does nothing - output to/dev/null.voidwrite(String str, int st, int end)Does nothing - output to/dev/null.-
Methods inherited from class java.io.Writer
nullWriter
-
-
-
-
Field Detail
-
NULL_WRITER
public static final NullWriter NULL_WRITER
A singleton.
-
-
Method Detail
-
append
public Writer append(char c)
Does nothing - output to/dev/null.- Specified by:
appendin interfaceAppendable- Overrides:
appendin classWriter- Parameters:
c- The character to write- Returns:
- this writer
- Since:
- 2.0
-
append
public Writer append(CharSequence csq, int start, int end)
Does nothing - output to/dev/null.- Specified by:
appendin interfaceAppendable- Overrides:
appendin classWriter- Parameters:
csq- The character sequence to writestart- The index of the first character to writeend- The index of the first character to write (exclusive)- Returns:
- this writer
- Since:
- 2.0
-
append
public Writer append(CharSequence csq)
Does nothing - output to/dev/null.- Specified by:
appendin interfaceAppendable- Overrides:
appendin classWriter- Parameters:
csq- The character sequence to write- Returns:
- this writer
- Since:
- 2.0
-
write
public void write(int idx)
Does nothing - output to/dev/null.
-
write
public void write(char[] chr)
Does nothing - output to/dev/null.
-
write
public void write(char[] chr, int st, int end)Does nothing - output to/dev/null.
-
write
public void write(String str)
Does nothing - output to/dev/null.
-
write
public void write(String str, int st, int end)
Does nothing - output to/dev/null.
-
flush
public void flush()
- Specified by:
flushin interfaceFlushable- Specified by:
flushin classWriter- See Also:
Writer.flush()
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classWriter- See Also:
Writer.close()
-
-