Name
Writer
Synopsis
Writer is an abstract class that defines the methods
implemented by subclasses that provide character output. A
Writer differs from an OutputStream
in that it works in terms of 16-bit Unicode characters rather than 8-bit bytes.
A sequence of Unicode characters can be safely converted to an 8-bit data
stream by wrapping an output stream with an instance of the
OutputStreamWriter class, which is the only concrete
subclass of Writer provided in the CLDC
java.io package.
Most of the methods provided by Writer are the same as those
available from OutputStream, except that the fundamental unit
of transfer is a char rather than a byte.
The write() methods copy Unicode characters
instead of bytes to the underlying storage. Writer
also provides overloaded variants of write() that write out
some or all of a String. Because some implementations may
buffer data internally, Writer provides a
flush() to force buffered data to be written. Buffered
data is always written out when the close()
method is called.
public abstract class Writer { // Protected Constructors protected Writer(); protected Writer( Object lock); // Public Instance Methods public abstract void close() throws IOException; public abstract void flush() throws IOException; public void write( String str) throws IOException; public void write(char[] cbuf) throws IOException; public void write( int c) throws IOException; public void write(String str, int off, int len) throws IOException; public abstract void ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access