J2ME Programming/Connected Limited Device Configuration
Introduction
editMany people confuse the role of CLDC in J2ME application development. It alone is not a framework for application development because you need more than a configuration to produce J2ME applications("J2ME". The J2ME Platform.). You can think of CLDC as the spec that helps define the subset of the J2ME language items such as input/output, math, and etc that the Java Virtual Machine uses as its set of rules in actually runing MIDlets under the Mobile Information Device Profile(MIDP).
Package Structure
editWe can get a clearer picture of this by observing what each package in the CLDC defines as the J2ME java subset. Although its not clear from the javadocs, Sun Microsystems does not separate MIDP and CLDC javadocs, these are the actual packages of CLDC("cldcapi" (PDF). CLDC API Documentation, V1.0.):
CLDC1.0 list of Packages under java.*
edit- java.lang.*
- java.io.*
- java.util.*
Thus, we have classes that deinfe the java language subset attributes used. How the java language subset definitions for input/output are used. Also, a language definition of the subset of java.util.* from the full java language.
Math Classes(CLDC1.0) in java.lang.* package from J2SE1.3
edit- java.lang.Long
- java.lang.Short
- java.lang.Integer
Notice when compared to J2SE math we have no floating point(Float class) and no double(Double class).
Utility Classes(CLDC1.0) from J2SE1.3
edit- java.lang.Math
- java.util.Random
System Classes(CLDC1.0) in java.lang.* package from J2SE1.3
edit- java.lang.System
- java.lang.Object
- java.lang.Runtime
- java.lang.Thread
- java.lang.Throwable
- java.lang.String
- java.lang.StringBuffer
Data Type Classes(CLDC1.0) in java.lang.* package from J2SE1.3 excluding math
edit- java.lang.Boolean
- java.lang.Byte
- java.lang.Character
Collection Classes(CLDC1.0) in java.util.* package from J2SE1.3
edit- java.util.Enumeration
- java.util.Hashtable(see note in conclusion, from jdk1.1.8 not jse1.3)
- java.util.Stack
- java.util.Vector(see note in conclusion, from jdk1.1.8 not jse1.3)
Calendar and Time Classes(CLDC1.0) in java.util.* package from J2SE1.3
edit- java.util.Calendar
- java.util.Date
- java.util.TimeZone
IO Classes(CLDC1.1) excluding GCF in java.io.* package from J2SE1.3
edit- java.io.Writer
- java.io.Reader
- java.io.ByteArrayInputStream
- java.io.ByteArrayOutputStream
- java.io.DataInputStream
- java.io.DataOutputStream
- java.io.InputStream
- java.io.OutputStream
- java.io.InputStreamWriter
- java.io.OuputStreamWriter
- java.io.PrintStream
Exception Classes(CLDC1.0) in java.util.* package from J2SE1.3
edit- java.util.EmptyStackException
- java.util.NoSuchElementException
Exception Classes(CLDC1.0) in java.io.* package from J2SE1.3
edit- java.io.EOFException
- java.io.IOException
- java.io.InterruptedException
- java.io.UnsupportedEncodingException
- java.io.UTFDataFormatException
Error Classes(CLDC1.0) in java.lang.* package from J2SE1.3
edit- java.lang.Error
- java.lang.VirtualMachineError
- java.lang.OutOfMemoryError
The other clases are mixed in with MIDP in the javadocs, thus I will list the full list of CLDC classes under the javax.microedition.io.* package. The class is the capitalized name at the right sight of the dot ending the package.
CLDC1.0 list of classes under javax.microedition.io.*
edit- javax.microedition.io.InputConnection
- javax.microedition.io.Connection
- javax.microedition.io.StreamConnection
- javax.microedition.io.OutputConnection
- javax.microedition.io.Datagram
- javax.microedition.io.DatagramConnection
- javax.microedition.io.StreamConnectionNotifier
- javax.microedition.io.ContentConnection
- javax.microedition.io.ConnectionNotFoundException
- javax.microedition.io.Connector
The common aspect that sets these classes apart is that they are interfaces defining the capabilities of the input/output connections. The classes in java.io.* define the java language attributes that input/output classes in javax.microedition.io.* use as their rule set.
CLDC1.1 additional classes
edit- java.lang.Float
- java.lang.Double
- java.lang.Math
GCF, General Connection Framework
editIn the J2ME platform the J2SE IO is replaced with a smaller General Connection Framework(GCF).
javax.microedition.io GCF Classes from CLDC1.0
edit- javax.microedition.io.InputConnection
- javax.microedition.io.Connection
- javax.microedition.io.StreamConnection
- javax.microedition.io.OutputConnection
- javax.microedition.io.DatagramConnection
- javax.microedition.io.StreamConnectionNotifier
- javax.microedition.io.ContentConnection
- javax.microedition.io.HttpConnection
Conclusion
editIn conclusion, under the subset of java language for CLDC we do not have floating point math, no double, no class loaders, no sockets and no serialization. A smaller IO framework known as GCF is used.
While the javadocs read MID Profile in top right corner the actual Configuration or Profile they belong to is noted down before the class method summary is listed as:
since CLDC1.0 or since MIDP1.0
Note, that not all classes are based on JDK1.3
Classes(CLDC1.0) Based on JDK1.1.8 instead of JDK1.3
edit- java.util.Vector
- java.util.Hashtable
These classes were based on JDK1.1.8 to conserve space.
CLDC1.0 Limitations
edit- Unicode Translation to and from reader/writer bytes is limited
- Does not support java.util.Properties from J2SE but limited stuff can be acquire as System.getProperty(String key) that starts with the keyword microedition
References
edit- "cldcapi" (PDF). CLDC API Documentation, V1.0.
- "KVM White paper" (PDF). J2ME Building Blocks for Mobile Devices White Paper on KVM and the Connected Limited Device Configuration (CLDC).
Trademark Notices
editJ2ME, Java and all Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.