Class NullWriter
java.lang.Object
java.io.Writer
org.apache.commons.io.output.NullWriter
- All Implemented Interfaces:
Closeable, Flushable, Appendable, AutoCloseable
Never writes data. Calls never go beyond this class.
This Writer has no destination (file/socket etc.) and all characters written to it are ignored and lost.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final NullWriterThe singleton instance.static final NullWriterDeprecated. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionappend(char c) Does nothing, like writing to/dev/null.append(CharSequence csq) Does nothing, like writing to/dev/null.append(CharSequence csq, int start, int end) Does nothing except argument validation, like writing to/dev/null.voidclose()voidflush()voidwrite(char[] chr) Does nothing except argument validation, like writing to/dev/null.voidwrite(char[] cbuf, int off, int len) Does nothing except argument validation, like writing to/dev/null.voidwrite(int b) Does nothing, like writing to/dev/null.voidDoes nothing except argument validation, like writing to/dev/null.voidDoes nothing except argument validation, like writing to/dev/null.
-
Field Details
-
INSTANCE
-
NULL_WRITER
Deprecated.UseINSTANCE.The singleton instance.
-
-
Constructor Details
-
NullWriter
-
-
Method Details
-
append
-
append
Does nothing, like writing to/dev/null.- Specified by:
appendin interfaceAppendable- Overrides:
appendin classWriter- Parameters:
csq- The character sequence to write.- Returns:
- this writer
- Since:
- 2.0
-
append
Does nothing except argument validation, like writing to/dev/null.- Specified by:
appendin interfaceAppendable- Overrides:
appendin classWriter- Parameters:
csq- The character sequence from which a subsequence will be appended. Ifcsqisnull, it is treated as if it were"null".start- The index of the first character in the subsequence.end- The index of the character following the last character in the subsequence.- Returns:
thisinstance.- Throws:
IndexOutOfBoundsException- Ifstartorendare negative,endis greater thancsq.length(), orstartis greater thanend.- Since:
- 2.0
-
close
-
flush
-
write
Does nothing except argument validation, like writing to/dev/null.- Overrides:
writein classWriter- Parameters:
chr- The characters to write, notnull.- Throws:
NullPointerException- ifchrisnull.
-
write
Does nothing except argument validation, like writing to/dev/null.- Specified by:
writein classWriter- Parameters:
cbuf- The characters to write, notnull.off- The start offset.len- The number of characters to write.- Throws:
NullPointerException- ifchrisnull.IndexOutOfBoundsException- If (offorlenare negative, oroff + lenis greater thancbuf.length.
-
write
-
write
Does nothing except argument validation, like writing to/dev/null.- Overrides:
writein classWriter- Parameters:
str- The string to write, notnull.- Throws:
NullPointerException- ifstrisnull.
-
write
Does nothing except argument validation, like writing to/dev/null.- Overrides:
writein classWriter- Parameters:
str- The string to write, notnull.off- The start offset.len- The number of characters to write.- Throws:
NullPointerException- Ifstrisnull.IndexOutOfBoundsException- If (offorlenare negative, oroff + lenis greater thanstr.length().
-
INSTANCE.