CLDC APIs

Packages included in CLDC are java.io, java.lang, java.util, and javax.microedition.io, where javax.microedition.io is mainly a replacement for the missing java.net package. Here, we will give only a short overview of the classes available. Please note that most classes do not provide all the methods of their J2SE counterparts. For detailed information, please consult the CLDC API documentation.

In Appendix B, “Comparison Charts,” you can find a table with hints for mapping functionality of J2SE classes and methods omitted in CLDC. The following classes are available in CLDC 1.1 only: Float, Double, java.lang.ref.Reference, java.lang.ref.Reference, and java.lang.ref. WeakReference.

The java.lang Package

Supported classes from java.lang are Object, the wrapper classes for the built-in data types, Math, Runtime, String, StringBuffer, System, Thread, and Throwable.

Depending on the CLDC version java.lang.Math might not contain operations for floating point numbers. java.lang.Class provides only very limited support for reflection.

The following classes are available in CLDC 1.1 only: Float, Double, java.lang.ref. Reference, java.lang.ref.Reference, and java.lang.ref.WeakReference.

The java.util Package

Supported classes from java.util are Calendar, Date, Hashtable, Random, Stack, TimeZone, and Vector.

The Java 2 collection framework is not supported at all. The Vector class contains only the old access methods elementAt(), setElementAt(), and addElement(), instead of the get(), set(), and add() methods introduced with the Java 2 collection framework. The only time zone required is GMT.

The java.io Package

Supported classes from java.io are ByteArrayInputStream, ByteArrayOutputStream, DataInputStream, DataOutputStream, InputStream, InputStreamReader, OutputStream, OutputStreamWriter, PrintStream, Reader, and Writer. As you can infer from the list, all file-related classes are missing. The CLDC does not provide any replacement, but MIDP provides the package javax.microedition.rms for persistent storage, and PDAP adds a FileConnection interface to the javax.microedition.io package.

The javax.microedition.io Package

The package javax.microedition.io is mainly a compact replacement for the java.net package, the so-called Generic Connection Framework (described in detail in Chapter 6, “Networking: The Generic Connection Framework”). It provides a set of classes and interfaces that let you establish different kinds of network connections.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset