java.io.BufferedWriter
BufferedWriter is for writing buffered character output. Characters written
to this Writer are buffered internally before being committed to the target
Writer.
Summary
protected |
|
|
Object |
lock |
The object used to synchronize access to the writer. |
Public Constructors
Public Methods
Methods inherited
from class
java.io.Writer
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
Details
Public Constructors
public
BufferedWriter(Writer out)
Constructs a new BufferedReader with
out
as the Writer on
which to buffer write operations. The buffer size is set to the default,
which is 8K.
Parameters
out
| The Writer to buffer character writing on
|
public
BufferedWriter(Writer out, int size)
Constructs a new BufferedReader with
out
as the Writer on
which buffer write operations. The buffer size is set to
size
.
Parameters
out
| The Writer to buffer character writing on. |
size
| The size of the buffer to use.
|
Public Methods
public
void
close()
Close this BufferedWriter. The contents of the buffer are flushed, the
target writer is closed, and the buffer is released. Only the first
invocation of close has any effect.
Throws
IOException
| If an error occurs attempting to close this Writer.
|
public
void
flush()
Flush this BufferedWriter. The contents of the buffer are committed to
the target writer and it is then flushed.
Throws
IOException
| If an error occurs attempting to flush this Writer.
|
public
void
newLine()
Write a newline to thie Writer. A newline is determined by the System
property "line.separator". The target writer may or may not be flushed
when a newline is written.
Throws
IOException
| If an error occurs attempting to write to this Writer.
|
public
void
write(char[] cbuf, int offset, int count)
Writes out
count
characters starting at
offset
in
buf
to this BufferedWriter. If
count
is greater than this Writers buffer then flush the
contents and also write the characters directly to the target Writer.
Parameters
cbuf
| the non-null array containing characters to write. |
offset
| offset in buf to retrieve characters |
count
| maximum number of characters to write |
public
void
write(String str, int offset, int count)
Writes out
count
characters starting at
offset
in
str
to this BufferedWriter. If
count
is greater than this Writers buffer then flush the
contents and also write the characters directly to the target Writer.
Parameters
str
| the non-null String containing characters to write |
offset
| offset in str to retrieve characters |
count
| maximum number of characters to write |
public
void
write(int oneChar)
Writes the character
oneChar
BufferedWriter. If the buffer
is filled by writing this character, flush this Writer. Only the lower 2
bytes are written.
Parameters
oneChar
| The Character to write out. |
Throws
IOException
| If this Writer has already been closed or some other
IOException occurs.
|