Reading Writing Text  «Prev  Next»


Lesson 10Java Writer class
ObjectiveFamiliarize yourself with the basic methods used to write text.

Write Text Files

The methods of the java.io.Writer class are deliberately similar to the methods of the java.io.OutputStream class. However, rather than working with bytes, they work with char data.
The main methods of the Writer class are:
  1. write()
  2. flush() and close()

We will be discussing these methods in detail over the next several lessons.
The Writer class also has a getEncoding() method, which returns a string containing the name of the encoding used by this writer.

public String getEncoding()