02 cldc

25
CLDC Connected, Limited Device Configuration Cornelius Koo - 2005

Upload: corneliuskoo

Post on 20-May-2015

715 views

Category:

Technology


0 download

DESCRIPTION

J2ME CLDC

TRANSCRIPT

Page 1: 02 cldc

CLDCConnected, Limited Device Configuration

Cornelius Koo - 2005

Page 2: 02 cldc

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

Page 3: 02 cldc

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)

Page 4: 02 cldc

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

Page 5: 02 cldc

JVM Specification for

CLDC

Page 6: 02 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.

Page 7: 02 cldc

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.

Page 8: 02 cldc

Weak References

• Garbage collector recognizes that an

object is being referenced, yet the object is

still a candidate for garbage collection.

Page 9: 02 cldc

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.

Page 10: 02 cldc

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.

Page 11: 02 cldc

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.

Page 12: 02 cldc

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.

Page 13: 02 cldc

CLDC Package

Page 14: 02 cldc

Java Classes

Page 15: 02 cldc

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

Page 16: 02 cldc

Data Type Classes

• java.lang.Boolean

• java.lang.Byte

• java.lang.Character

• java.lang.Integer

• java.lang.Long

• java.lang.Short

Page 17: 02 cldc

Collection Classes

• java.util.Enumeration

• java.util.Hashtable

• java.util.Stack

• java.util.Vector

Page 18: 02 cldc

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

Page 19: 02 cldc

Calendar and Time Classes

• java,util.Calendar

• java.util.Date

• java.util.TimeZone

Page 20: 02 cldc

Utility Classes

• java.util.Math

• java.util.Random

Page 21: 02 cldc

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

Page 22: 02 cldc

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

Page 23: 02 cldc

Error Classes

• java.lang.Error

• java.lang.OutOfMemoryError

• java.lang.VirtualMachineError

Page 24: 02 cldc

Internationalization

• java.io.InputStreamReader

• java.io.OutputStreamWriter

• both can be used to convert from bytes

to/from unicode.

Page 25: 02 cldc

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.