IT. Expert System.

Android Reference

BufferedWriter


java.io

Class BufferedWriter

  • All Implemented Interfaces:
    Closeable, Flushable, Appendable, AutoCloseable


    public class BufferedWriter
    extends Writer
    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.

    A typical application pattern for the class looks like this:

     BufferedWriter buf = new BufferedWriter(new FileWriter("file.java"));
     
    See Also:
    BufferedReader
    • Field Summary

    • Constructor Summary

      Constructors
      Constructor and Description
      BufferedWriter(Writer out)
      Constructs a new BufferedWriter, providing out with a buffer of 8192 bytes.
      BufferedWriter(Writer out, int size)
      Constructs a new BufferedWriter, providing out with size bytes of buffer.
    • Constructor Detail

      • BufferedWriter

        public BufferedWriter(Writer out)
        Constructs a new BufferedWriter, providing out with a buffer of 8192 bytes.
        Parameters:
        out - the Writer the buffer writes to.
      • BufferedWriter

        public BufferedWriter(Writer out,
                      int size)
        Constructs a new BufferedWriter, providing out with size bytes of buffer.
        Parameters:
        out - the OutputStream the buffer writes to.
        size - the size of buffer in bytes.
        Throws:
        IllegalArgumentException - if size <= 0.
    • Method Detail

      • close

        public void close()
                   throws IOException
        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.
        Specified by:
        close in interface Closeable
        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in class Writer
        Throws:
        IOException - if an error occurs while closing this writer.
      • flush

        public void flush()
                   throws IOException
        Flushes this writer. The contents of the buffer are committed to the target writer and it is then flushed.
        Specified by:
        flush in interface Flushable
        Specified by:
        flush in class Writer
        Throws:
        IOException - if an error occurs while flushing this writer.
      • newLine

        public void newLine()
                     throws IOException
        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.
        Throws:
        IOException - if an error occurs attempting to write to this writer.
      • write

        public void write(char[] buffer,
                 int offset,
                 int count)
                   throws IOException
        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.
        Specified by:
        write in class Writer
        Parameters:
        buffer - the array containing characters to write.
        offset - the start position in buffer for retrieving characters.
        count - the maximum number of characters to write.
        Throws:
        IndexOutOfBoundsException - if offset < 0 or count < 0, or if offset + count is greater than the size of buffer.
        IOException - if this writer is closed or another I/O error occurs.
      • write

        public void write(int oneChar)
                   throws IOException
        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.
        Overrides:
        write in class Writer
        Parameters:
        oneChar - the character to write.
        Throws:
        IOException - if this writer is closed or another I/O error occurs.
      • write

        public void write(String str,
                 int offset,
                 int count)
                   throws IOException
        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.
        Overrides:
        write in class Writer
        Parameters:
        str - the non-null String containing characters to write.
        offset - the start position in str for retrieving characters.
        count - maximum number of characters to write.
        Throws:
        IOException - if this writer has already been closed or another I/O error occurs.
        IndexOutOfBoundsException - if offset < 0 or offset + count is greater than the length of str.


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 774 / . Delta: 0.02004 с