CLDC Connected, Limited Device Configuration Cornelius Koo - 2005
May 20, 2015
CLDCConnected, Limited Device Configuration
Cornelius Koo - 2005
CLDC Devices Characteristics
• 160 - 512 kb total memory available for
java platform
• 16 bit / 32 bit processor
• low power consumption, often battery
powered
• intermitten network connectivity (often
wireless), limited bandwith
Hardware Requirements
• CLDC doesnt have specific hardware
requirements
• Minimal memory requirements :
• 128 kb - for running the JVM and CLDC libraries.
This memory must preserve its content, even
when the device is powered off. (Nonvolatile
memory)
• 32 kb - available during application runtime for
allocation of objects. (Volatile memory / heap)
Software Requirements
• The Operating System must be able to
running JVM and managing Java
applications on the device including :
Select and launch application
Remove application
JVM Specification for
CLDC
Java Language for CLDC
• CLDC doesn’t support floating point type. (double and float)
• CLDC doesn’t support finalize()
method.
• CLDC only support limited set of Exception classes for error handling.
Java Virtual Machine for CLDC
• JVM doesn’t support floating point operation.
• JVM doesn’t support native interface and native
method invocation.
• Reflection is not available.
• JVM must implement the classloader.
• finalize() method is not available.
• JVM doesn’t suport ThreadGroup class.
• JVM doesn’t support weak references.
Weak References
• Garbage collector recognizes that an
object is being referenced, yet the object is
still a candidate for garbage collection.
Security Handling
• Any devices running Java application will
need protection from malicious codes that
may access system information or
resources.
• This “Low Level” protection is
implemented through class file verification.
CLDC Class File Verification
• Class file verification is done in 2 steps in
CLDC.
• 1st Step is pre-verification.
• 2nd Step is in-device verification.
Pre-Verification
• Pre-verification :
• A software program is run to insert additional attributes into the class file.
• Class file will be approximately 5% larger after pre-verification.
• Done as part of development process or before a class file is loaded on a device.
• A "Stack Maps" is added to the class file, describing what variables and operands are art of the interpreter stack space.
In-Device Verification
• In-Device verification :
• Once a device loads a pre-verified class file, the in-device verifier runs through each instruction.
• There are several checks done to validate the code.
• At any point the verifier can report and reject the class file.
• Code verifier program for KVM is in the range of 10kb and less than 100 bytes of heap space required.
CLDC Package
Java Classes
System Classes
• java.lang.Class
• java.lang.Object
• java.lang.Runnable
• java.lang.Runtime
• java.lang.String
• java.lang.StringBuffer
• java.lang.System
• java.lang.Thread
• java.lang.Throwable
Data Type Classes
• java.lang.Boolean
• java.lang.Byte
• java.lang.Character
• java.lang.Integer
• java.lang.Long
• java.lang.Short
Collection Classes
• java.util.Enumeration
• java.util.Hashtable
• java.util.Stack
• java.util.Vector
I/O Classes
• java.io.ByteArrayInputStream
• java.io.ByteArrayOutputStream
• java.io.DataInput
• java.io.DataInputStream
• java.io.DataOutput
• java.io.DataOutputStream
• java.io.InputStream
• java.io.InputStreamReader
• java.io.OutputStream
• java.io.OutputStreamWriter
• java.io.PrintStream
• java.io.Reader
• java.io.Writer
Calendar and Time Classes
• java,util.Calendar
• java.util.Date
• java.util.TimeZone
Utility Classes
• java.util.Math
• java.util.Random
Exception Classes
• java.io.EOFException
• java.io.InterruptedIOException
• java.io.IOException
• java.io.UnsupportedEncodingException
• java.io.UTFDataFormatException
• java.lang.ArithmeticException
• java.lang.ArrayIndexOutOfBoundsException
• java.lang.ArrayStoreException
• java.lang.ClassCastException
• java.lang.ClassNotFoundException
• java.lang.Exception
• java.lang.IllegalAccessException
• java.lang.IllegalArgumentException
Exception Classes
• java.lang.IllegalMonitorStateException
• java.lang.IllegalThreadStateException
• java.lang.IndexOutOfBoundsException
• java.lang.InstantiationException
• java.lang.InterruptedException
• java.lang.NegativeArraySizeException
• java.lang.NullPointerException
• java.lang.NumberFormatException
• java.lang.RuntimeException
• java.lang.SecurityException
• java.lang.StringIndexOutOfBoundsException
• java.util.EmptyStackException
• java.util.NoSuchElementException
Error Classes
• java.lang.Error
• java.lang.OutOfMemoryError
• java.lang.VirtualMachineError
Internationalization
• java.io.InputStreamReader
• java.io.OutputStreamWriter
• both can be used to convert from bytes
to/from unicode.
Reference
• Core J2ME Technology and MIDP. John W. Muchow. Prentice Hall PTR, 2002.
• Enterprise J2ME: Developing Mobile Java Applications. Michael Juntao Yuan. Prentice Hall PTR, 2003.
• J2ME in A Nutshell. Kim Topley. Oreilly, 2002.
• Wireless J2ME Platform Programming.Vartan Piroumian. Prentice Hall, 2002.