Android
java.io
public class

java.io.BufferedWriter

java.lang.Object
java.io.Writer Closeable Flushable Appendable
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.

See Also

Summary

Fields inherited from class java.io.Writer

Public Constructors

            BufferedWriter(Writer out)
Constructs a new BufferedReader with out as the Writer on which to buffer write operations.
            BufferedWriter(Writer out, int size)
Constructs a new BufferedReader with out as the Writer on which buffer write operations.

Public Methods

          void  close()
Close this BufferedWriter.
          void  flush()
Flush this BufferedWriter.
          void  newLine()
Write a newline to thie Writer.
          void  write(char[] cbuf, int offset, int count)
Writes out count characters starting at offset in buf to this BufferedWriter.
          void  write(String str, int offset, int count)
Writes out count characters starting at offset in str to this BufferedWriter.
          void  write(int oneChar)
Writes the character oneChar BufferedWriter.
Methods inherited from class java.io.Writer
Methods inherited from class java.lang.Object
Methods inherited from interface java.io.Closeable
Methods inherited from interface java.io.Flushable
Methods inherited from interface java.lang.Appendable

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

Throws

IOException If this Writer has already been closed or some other IOException occurs.
IndexOutOfBoundsException If offset or count are outside of bounds.

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

Throws

IOException If this Writer has already been closed or some other IOException occurs.
ArrayIndexOutOfBoundsException If offset or count are outside of bounds.

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.
Copyright 2007 Google Inc. Build 0.9_r1-98467 - 14 Aug 2008 18:48