See the
BOLD Text of my book, below...
4.4.1 Writers
The Writer class mirrors the java.io.OutputStream class. It's abstract and has two protected constructors. Like OutputStream, the Writer class is never used directly; instead, it is used polymorphically, through one of its subclasses. It has five write() methods as well as a flush( ) and a close( ) method:
protected Writer( )
protected Writer(Object lock)
public
abstract void write(char[] text, int offset, int length)
throws IOException
public void write(int c) throws IOException
public void write(char[] text) throws IOException
public void write(
String s) throws IOException
public void write(String s, int offset, int length) throws IOException
public abstract void flush( ) throws IOException
public abstract void close( ) throws IOException
The write(char[] text, int offset, int length) method is the base method in terms of which the other four write( ) methods are implemented. A subclass must override at least this method as well as flush( ) and close(),
although most override some of the other write( ) methods as well in order to provide more efficient implementations. For example, given a Writer object w, you can write the string "Network" like this:
char[] network = {'N', 'e', 't', 'w', 'o', 'r', 'k'};
w.write(network, 0, network.length);
The same task can be accomplished with these other methods, as well:
w.write(network);
for (int i = 0; i < network.length; i++) w.write(network[i]);
w.write("Network");
w.write("Network", 0, 7);