Top Description Fields Constructors Methods
org.apache.commons.io.output

public Class NullWriter

extends Writer
Class Inheritance
Imports
java.io.Writer

This 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.

Version
$Id: NullWriter.java 462832 2006-10-11 15:48:09Z scolebourne $

Field Summary

Inherited from java.io.Writer:
lock

Constructor Summary

AccessConstructor and Description
public
NullWriter()

Constructs a new NullWriter.

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements abstract java.io.Writer.close.

Implements java.io.Closeable.close.

Closes the stream, flushing it first.
public void
flush()

Implements abstract java.io.Writer.flush.

Implements java.io.Flushable.flush.

Flushes the stream.
public void
write(int
int specifying a character to be written
idx
)

Overrides java.io.Writer.write.

Writes a single character.
public void
write(char[]
Array of characters to be written
chr
)

Overrides java.io.Writer.write.

Writes an array of characters.
public void
write(char[]
Array of characters
chr
,
int
Offset from which to start writing characters
st
,
int
Number of characters to write
end
)

Implements abstract java.io.Writer.write.

Writes a portion of an array of characters.
public void
write(String
String to be written
str
)

Overrides java.io.Writer.write.

Writes a string.
public void
write(String
A String
str
,
int
Offset from which to start writing characters
st
,
int
Number of characters to write
end
)

Overrides java.io.Writer.write.

Writes a portion of a string.
Inherited from java.io.Writer:
appendappendappendnullWriter

Constructor Detail

NullWriterback to summary
public NullWriter()

Constructs a new NullWriter.

Method Detail

closeback to summary
public void close()

Implements abstract java.io.Writer.close.

Implements java.io.Closeable.close.

Doc from java.io.Writer.close.

Closes the stream, flushing it first. Once the stream has been closed, further write() or flush() invocations will cause an IOException to be thrown. Closing a previously closed stream has no effect.

See Also
java.io.Writer#close()
flushback to summary
public void flush()

Implements abstract java.io.Writer.flush.

Implements java.io.Flushable.flush.

Doc from java.io.Writer.flush.

Flushes the stream. If the stream has saved any characters from the various write() methods in a buffer, write them immediately to their intended destination. Then, if that destination is another character or byte stream, flush it. Thus one flush() invocation will flush all the buffers in a chain of Writers and OutputStreams.

If the intended destination of this stream is an abstraction provided by the underlying operating system, for example a file, then flushing the stream guarantees only that bytes previously written to the stream are passed to the operating system for writing; it does not guarantee that they are actually written to a physical device such as a disk drive.

See Also
java.io.Writer#flush()
writeback to summary
public void write(int idx)

Overrides java.io.Writer.write.

Doc from java.io.Writer.write.

Writes a single character. The character to be written is contained in the 16 low-order bits of the given integer value; the 16 high-order bits are ignored.

Subclasses that intend to support efficient single-character output should override this method.

Parameters
idx:int

int specifying a character to be written

See Also
java.io.Writer#write(int)
writeback to summary
public void write(char[] chr)

Overrides java.io.Writer.write.

Doc from java.io.Writer.write.

Writes an array of characters.

Parameters
chr:char[]

Array of characters to be written

See Also
java.io.Writer#write(char[])
writeback to summary
public void write(char[] chr, int st, int end)

Implements abstract java.io.Writer.write.

Doc from java.io.Writer.write.

Writes a portion of an array of characters.

Parameters
chr:char[]

Array of characters

st:int

Offset from which to start writing characters

end:int

Number of characters to write

See Also
java.io.Writer#write(char[], int, int)
writeback to summary
public void write(String str)

Overrides java.io.Writer.write.

Doc from java.io.Writer.write.

Writes a string.

Parameters
str:String

String to be written

See Also
java.io.Writer#write(String)
writeback to summary
public void write(String str, int st, int end)

Overrides java.io.Writer.write.

Doc from java.io.Writer.write.

Writes a portion of a string.

Parameters
str:String

A String

st:int

Offset from which to start writing characters

end:int

Number of characters to write

See Also
java.io.Writer#write(String, int, int)