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 ...
Get J2ME in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.