Java Reference
In-Depth Information
Changing the Java Class Library to Fit the CDC
The joy of working with the CDC is that there
are
no changes to fit the Java SE class hier-
archy—what you see in Java SE is what you get in the Java ME CDC. As previously noted,
however, the CDC is a superset of the CLDC; the GCF is included in the CDC as well.
Table 2-6 shows the classes provided by the CDC in the
javax.microedition.io
package.
Table 2-6.
javax.microedition.io Library Additions to the CDC
Connection
ConnectionNotFoundException
Connector
ContentConnection
Datagram
HttpConnection
HttpsConnection
*
SecureConnection
*
StreamConnectionNotifier
InputConnection
OutputConnection
DatagramConnection
StreamConnection
*Only if the device supports HTTPS.
Note that the CDC supports HTTP out of the box, as opposed to the CLDC, which
does not include HTTP except as provided by the MIDP.
Wrapping Up
If you take away one thing from this chapter, it's that the key difference between the
CLDC and the CDC is what's included in terms of classes. The CLDC contains
far
fewer
classes than the CDC, which is at parity with Java SE 1.4.2. Notable classes missing in the
CLDC include most of the
java.util
hierarchy. Specifically, all of the collections except
vectors, hashtables, and stacks are missing. Also, the CLDC provides streamlined time-
management APIs, including a subset of
java.util.Date
,
java.util.Calendar
, and
java.util.TimeZone
. Finally, it possesses a simplified
java.io
hierarchy.