| java.lang.Object | ||
| ↳ | java.io.Writer | |
| ↳ | java.io.BufferedWriter | |
Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is minimized, since most (smaller) requests can be satisfied by accessing the buffer alone. The drawback is that some extra space is required to hold the buffer and that copying takes place when filling that buffer, but this is usually outweighed by the performance benefits. 
 BufferedWriter buf = new BufferedWriter(new FileWriter("file.java"));
 
       
      | [Expand] 
           Inherited Fields
           | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|  From class java.io.Writer | |||||||||||
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|  | 
           Constructs a new 
            BufferedWriter, providingoutwith a buffer of 8192 bytes. | ||||||||||
|  | 
           Constructs a new 
            BufferedWriter, providingoutwithsizebytes of buffer. | ||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|  | 
           Closes this writer.
           | ||||||||||
|  | 
           Flushes this writer.
           | ||||||||||
|  | 
           Writes a newline to this writer.
           | ||||||||||
|  | 
           Writes 
            countcharacters starting atoffsetinbufferto this writer. | ||||||||||
|  | 
           Writes 
            countcharacters starting atoffsetinstrto this writer. | ||||||||||
|  | 
           Writes the character 
            oneCharto this writer. | ||||||||||
| [Expand] 
           Inherited Methods
           | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|  From class java.io.Writer | |||||||||||
|  From class java.lang.Object | |||||||||||
|  From interface java.io.Closeable | |||||||||||
|  From interface java.io.Flushable | |||||||||||
|  From interface java.lang.Appendable | |||||||||||
Constructs a new BufferedWriter, providing out with a buffer of 8192 bytes.
| out | the Writerthe buffer writes to. | 
|---|
Constructs a new BufferedWriter, providing out with size bytes of buffer.
| out | the OutputStreamthe buffer writes to. | 
|---|---|
| size | the size of buffer in bytes. | 
| IllegalArgumentException | if size <= 0. | 
|---|
Closes this writer. 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.
| IOException | if an error occurs while closing this writer. | 
|---|
Flushes this writer. The contents of the buffer are committed to the target writer and it is then flushed.
| IOException | if an error occurs while flushing this writer. | 
|---|
Writes a newline to this writer. On Android, this is "\n". The target writer may or may not be flushed when a newline is written.
| IOException | if an error occurs attempting to write to this writer. | 
|---|
Writes count characters starting at offset in buffer to this writer. If count is greater than this writer's buffer, then the buffer is flushed and the characters are written directly to the target writer.
| buffer | the array containing characters to write. | 
|---|---|
| offset | the start position in bufferfor retrieving characters. | 
| count | the maximum number of characters to write. | 
| IndexOutOfBoundsException | if offset < 0orcount < 0, or ifoffset + countis greater than the size ofbuffer. | 
|---|---|
| IOException | if this writer is closed or another I/O error occurs. | 
Writes count characters starting at offset in str to this writer. If count is greater than this writer's buffer, then this writer is flushed and the remaining characters are written directly to the target writer. If count is negative no characters are written to the buffer. This differs from the behavior of the superclass.
| str | the non-null String containing characters to write. | 
|---|---|
| offset | the start position in strfor retrieving characters. | 
| count | maximum number of characters to write. | 
| IOException | if this writer has already been closed or another I/O error occurs. | 
|---|---|
| IndexOutOfBoundsException | if offset < 0oroffset + countis greater than the length ofstr. | 
Writes the character oneChar to this writer. If the buffer gets full by writing this character, this writer is flushed. Only the lower two bytes of the integer oneChar are written.
| oneChar | the character to write. | 
|---|
| IOException | if this writer is closed or another I/O error occurs. | 
|---|