Index (Frames) | Index (No Frames) | Package | Package Tree | Tree
java.io

Class BufferedWriter

java.lang.Object
|
+--java.io.Writer
   |
   +--java.io.BufferedWriter


public class BufferedWriter

extends Writer

This class accumulates chars written in a buffer instead of immediately writing the data to the underlying output sink. The chars are instead as one large block when the buffer is filled, or when the stream is closed or explicitly flushed. This mode operation can provide a more efficient mechanism for writing versus doing numerous small unbuffered writes.

Authors:

Constructor Summary

BufferedWriter(java.io.Writer out)

This method initializes a new BufferedWriter instance that will write to the specified subordinate Writer and which will use a default buffer size of 512 chars.
BufferedWriter(java.io.Writer ox, int size)

This method initializes a new BufferedWriter instance that will write to the specified subordinate Writer and which will use the specified buffer size

Method Summary

voidclose()

This method flushes any remaining buffered chars then closes the underlying output stream.
voidflush()

This method causes any currently buffered chars to be immediately written to the underlying output stream.
voidnewLine()

This method writes out a system depedent line separator sequence.
voidwrite(int oneChar)

This method writes a single char of data.
voidwrite(char[] buf, int offset, int len)

This method writes len chars from the char array buf starting at position offset in the buffer.
voidwrite(java.lang.String str, int offset, int len)

This method writes len chars from the String str starting at position offset in the string.

Constructor Details

BufferedWriter

public BufferedWriter(java.io.Writer out)

This method initializes a new BufferedWriter instance that will write to the specified subordinate Writer and which will use a default buffer size of 512 chars.

Parameters:


BufferedWriter

public BufferedWriter(java.io.Writer ox, int size)

This method initializes a new BufferedWriter instance that will write to the specified subordinate Writer and which will use the specified buffer size

Parameters:


Method Details

close

public void close()

This method flushes any remaining buffered chars then closes the underlying output stream. Any further attempts to write to this stream may throw an exception


flush

public void flush()

This method causes any currently buffered chars to be immediately written to the underlying output stream.

Throws:


newLine

public void newLine()

This method writes out a system depedent line separator sequence. The actual value written is detemined from the line.separator system property.

Throws:


write

public void write(char[] buf, int offset, int len)

This method writes len chars from the char array buf starting at position offset in the buffer. These chars will be written to the internal buffer. However, if this write operation fills the buffer, the buffer will be flushed to the underlying output stream.

Parameters:

Throws:


write

public void write(int oneChar)

This method writes a single char of data. This will be written to the buffer instead of the underlying data source. However, if the buffer is filled as a result of this write request, it will be flushed to the underlying output stream.

Parameters:

Throws:


write

public void write(java.lang.String str, int offset, int len)

This method writes len chars from the String str starting at position offset in the string. These chars will be written to the internal buffer. However, if this write operation fills the buffer, the buffer will be flushed to the underlying output stream.

Parameters:

Throws: