Name
DataOutput
Synopsis
This interface is implemented by classes that write strings and Java
primitive types to a platform-independent binary encoding that can be
read by a class implementing the DataInput
interface.
Methods are provided for writing a single byte or an array of bytes as
well as primitives of type boolean
,
char
, int
,
long
and short
.
The writeChars()
method writes the content of a
String
as an array of 16-bit characters. In many cases, it
is more efficient to output a String
by using the
writeUtf()
method. This method encodes the characters in
the String
using a slightly modified form of UTF-8, which
results in Unicode characters with values in the range 0-127 inclusive being
encoded as a single byte. This is an optimization for the most common
characters in Western locales.
public interface DataOutput { // Public Instance Methods public abstract void write( byte[] b) throws IOException; public abstract void write( int b) throws IOException; public abstract void write(byte[] b, int off, int len) throws IOException; public abstract void writeBoolean( boolean v) throws IOException; public abstract void writeByte( int v) throws IOException; public abstract void writeChar( int v) throws IOException; public abstract void writeChars( String s) throws IOException; public abstract void writeInt( int v) throws IOException; public abstract void writeLong(long v) throws IOException; public abstract void writeShort(int v) throws IOException; public abstract void writeUTF( String ...
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.