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.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.
-
-
Field Summary
Fields Modifier and Type Field Description static NullWriter
NULL_WRITER
A 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.Writer
append(char c)
Does nothing - output to/dev/null
.java.io.Writer
append(java.lang.CharSequence csq)
Does nothing - output to/dev/null
.java.io.Writer
append(java.lang.CharSequence csq, int start, int end)
Does nothing - output to/dev/null
.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(java.lang.String str)
Does nothing - output to/dev/null
.void
write(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:
append
in interfacejava.lang.Appendable
- Overrides:
append
in 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:
append
in interfacejava.lang.Appendable
- Overrides:
append
in 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:
append
in interfacejava.lang.Appendable
- Overrides:
append
in 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:
write
in classjava.io.Writer
- Parameters:
idx
- The character to write
-
write
public void write(char[] chr)
Does nothing - output to/dev/null
.- Overrides:
write
in 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:
write
in 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:
write
in 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:
write
in classjava.io.Writer
- Parameters:
str
- The string to writest
- The start offsetend
- The number of characters to write
-
flush
public void flush()
- Specified by:
flush
in interfacejava.io.Flushable
- Specified by:
flush
in classjava.io.Writer
- See Also:
Writer.flush()
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in classjava.io.Writer
- See Also:
Writer.close()
-
-