Package org.apache.commons.io.output
Class NullWriter
- java.lang.Object
-
- java.io.Writer
-
- org.apache.commons.io.output.NullWriter
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.Appendable,java.lang.AutoCloseable
public class NullWriter extends java.io.WriterWrites 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 java.io.Writerappend(char c)Does nothing - output to/dev/null.java.io.Writerappend(java.lang.CharSequence csq)Does nothing - output to/dev/null.java.io.Writerappend(java.lang.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(java.lang.String str)Does nothing - output to/dev/null.voidwrite(java.lang.String str, int st, int end)Does nothing - output to/dev/null.
-
-
-
Field Detail
-
NULL_WRITER
public static final NullWriter NULL_WRITER
A singleton.
-
-
Method Detail
-
append
public java.io.Writer append(char c)
Does nothing - output to/dev/null.- Specified by:
appendin interfacejava.lang.Appendable- Overrides:
appendin classjava.io.Writer- Parameters:
c- The character to write- Returns:
- this writer
- Since:
- 2.0
-
append
public java.io.Writer append(java.lang.CharSequence csq, int start, int end)Does nothing - output to/dev/null.- Specified by:
appendin interfacejava.lang.Appendable- Overrides:
appendin classjava.io.Writer- 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 java.io.Writer append(java.lang.CharSequence csq)
Does nothing - output to/dev/null.- Specified by:
appendin interfacejava.lang.Appendable- Overrides:
appendin classjava.io.Writer- 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.- Overrides:
writein classjava.io.Writer- Parameters:
idx- The character to write
-
write
public void write(char[] chr)
Does nothing - output to/dev/null.- Overrides:
writein classjava.io.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:
writein classjava.io.Writer- Parameters:
chr- The characters to writest- The start offsetend- The number of characters to write
-
write
public void write(java.lang.String str)
Does nothing - output to/dev/null.- Overrides:
writein classjava.io.Writer- Parameters:
str- The string to write
-
write
public void write(java.lang.String str, int st, int end)Does nothing - output to/dev/null.- Overrides:
writein classjava.io.Writer- Parameters:
str- The string to writest- The start offsetend- The number of characters to write
-
flush
public void flush()
- Specified by:
flushin interfacejava.io.Flushable- Specified by:
flushin classjava.io.Writer- See Also:
Writer.flush()
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein classjava.io.Writer- See Also:
Writer.close()
-
-