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
Writer
has no destination (file/socket etc.) and all characters written to it are ignored and lost.
-
Field Summary
Fields Modifier and Type Field and Description static NullWriter
NULL_WRITER
A singleton.
Constructor Summary
Constructors Constructor and Description NullWriter()
Constructs a new NullWriter.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description Writer
append(char c)
Does nothing - output to/dev/null
.Writer
append(CharSequence csq)
Does nothing - output to/dev/null
.Writer
append(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(String str)
Does nothing - output to/dev/null
.void
write(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 Writer append(char c)
Does nothing - output to/dev/null
.- Specified by:
-
append
in interfaceAppendable
- Overrides:
-
append
in 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:
-
append
in interfaceAppendable
- Overrides:
-
append
in classWriter
- Parameters:
-
csq
- The character sequence to write -
start
- The index of the first character to write -
end
- 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:
-
append
in interfaceAppendable
- Overrides:
-
append
in 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:
-
flush
in interfaceFlushable
- Specified by:
-
flush
in classWriter
- See Also:
-
Writer.flush()
close
public void close()
- Specified by:
-
close
in interfaceCloseable
- Specified by:
-
close
in interfaceAutoCloseable
- Specified by:
-
close
in classWriter
- See Also:
-
Writer.close()
Copyright © 2002–2021 The Apache Software Foundation. All rights reserved.