Team LiB
Previous Section Next Section

Java 1.1appendable closeable flushable

This class applies buffering to a character output stream, improving output efficiency by coalescing many small write requests into a single larger request. You create a BufferedWriter by specifying some other character output stream to which it sends its buffered and coalesced output. (You can also specify a buffer size at this time, although the default size is usually satisfactory.) Typically, you use this sort of buffering with a FileWriter or OutputStreamWriter. BufferedWriter defines the standard write( ), flush( ), and close( ) methods all output streams define, but it adds a newLine( ) method that outputs the platform-dependent line separator (usually a newline character, a carriage-return character, or both) to the stream. BufferedWriter is the character-stream analog of BufferedOutputStream.

Figure 9-4.

public class BufferedWriter extends Writer {
// Public Constructors
     public BufferedWriter(Writer out);  
     public BufferedWriter(Writer out, int sz);  
// Public Instance Methods
     public void newLine( ) throws IOException;  
// Public Methods Overriding Writer
     public void close( ) throws IOException;  
     public void flush( ) throws IOException;  
     public void write(int c) throws IOException;  
     public void write(char[ ] cbuf, int off, int len) throws IOException;  
     public void write(String s, int off, int len) throws IOException;  

    Team LiB
    Previous Section Next Section