1 / 20

Java 2 Micro Edition

Java 2 Micro Edition. The Connected, Limited Device Configuration. Chapter Objectives. CLDC Specification CLDC Scope Limitations of Java Language Support in CLDC The Core API CLDC Packages Common CLDC Packages Using. CLDC.

zoltin
Download Presentation

Java 2 Micro Edition

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Java 2 Micro Edition The Connected, Limited Device Configuration

  2. Chapter Objectives • CLDC Specification • CLDC Scope • Limitations of Java Language Support in CLDC • The Core API • CLDC Packages • Common CLDC Packages Using

  3. CLDC • CLDC is the Connected, Limited Device Configuration. The first goal is to define a specification for a JVM called the KVM (K for kilo) and the second is to define a set of Java classes (libraries). • Hardware Requirements: • 128 kilobytes of nonvolatile memory for running the JVM and the CLDC libraries. • 32 kilobytes of volatile memory available during application runtime for allocation of objects. • With an intermittent network connection • Software Requirements: The host OS must be capable of running the JVM and managing Java applications on the device, including: • Selecting and launching of applications • The ability to remove Java applications from the device The implementation of these features is not specified in the CLDC, and thus is device-dependent and left to the manufacturer.

  4. CLDC Scope

  5. Features Tossed Overboard Because the KVM has to be so much smaller than a J2SE JVM, some features are missing: • No floating point support • No user classloaders • No finalization • No reflection • This implies no serialization,RMI, or JINI • No native methods • Except those that arecompiled into the JVM

  6. Core Packages • CLDC Packages • java.io Standard Java IO classes and packages; subset of the J2SE package • java.util VM classes and interfaces; subset of the J2SE package • java.util Standard utility classes and interfaces; subset of the J2SE package • javax.microedition.io CLDC generic connection framework classes and interfaces

  7. CLDC packages • java.util packageThis package has the classes that are fundamental to the Java language. These classes define the data types, basic exceptions, and so on. Many classes that are not required in J2ME are absent. • java.io packageThis package for providing data input and output through data streams. Because of the limited input/output capabilities of the mobile devices, this package provides limited functionality as compared to the java.io package in Java Standard Edition. • java.util packageThis package contains the utility classes for such things as generating random numbers, creating time zone objects, implementing growable array of objects, enumeration, and so on.

  8. java.util.object java.util.Thread java.util.Boolean java.util.Math java.util.Byte java.util.Calendar java.util.Integer java.util.Character java.util.Long java.util.Class java.util.Short java.util.String java.util.StringBuffer java.util.Runtime java.util.System Commonly Used Packages

  9. java.io.InputStream java.io.ByteArrayInputStream java.util.Date java.io.DataInputStream java.util.Random java.io.OutputStream java.util.Hashtable java.io.ByteArrayOutputStream java.util.Long java.io.DataOutputStream java.util.Timezone java.io.PrintStream java.util.Vector java.io.Reader java.util.Stack java.io.InputStreamReader java.io.Writer java.io.OutputStreamWriter Commonly Used Packages

  10. Multithreading • Creating and starting threads is the same as J2SE, using java.lang.Thread • The Runnable interface is also present • Unsupported: • Thread naming • Daemon threads • suspend(), resume(), and stop() • interrupt()

  11. String and StringBuffer • These classes are much the same as in J2SE • Note that you will probably have to be more careful about the number of Strings you’re creating you’re creating • It’s easy to use Strings carelessly • The constraints of a small device will highlight inefficient algorithms

  12. java.lang.Math • In J2SE, Math contains many static methods, mainly for trigonometry • MIDP has no floating point support, so only a handful of integer-based methods remain • See the API documentation

  13. Runtime • Provides access to the KVM • See the API documentation

  14. System • Provides system-wide services • There’s no There’s no System.in • See the API documentation

  15. Streams in java.io • MIDP’s java.io is a lot smaller than J2SE’s java.io • There are three reasons for the differences: • MIDP has no local file system • MIDP has no object serialization • MIDP doesn’t include most of the utility streams that are present in J2SE • Reader and Writer are available, but don’t count on a lot of available encoding schemes

  16. Collections • MIDP reverts back to the JDK 1.0 collections • Vector • Hashtable • Usage is much the same as it was in JDK 1.0 and JDK 1.1 • Note that new Collections API methods are not available • For example, Vector has the old addElement() method but not the Collections API add() method

  17. Timers • MIDP includes java.util.Timer and java.util.TimerTask • These were introduced into J2SE in the 1.3 SDK • The APIs are almost exactly the same as in J2SE • See the API documentation

  18. Telling Time • java.util.Date represents a point in time • java.util.Calendar translates between points in time and calendar fields • javax.microedition.lcdui.DateField is for the display and editing of points in time • We’ll cover this later • java.util.TimeZone represents a time zone and is used by the Calendar and DateField classes

  19. Lab

  20. Summary • CLDC is the Connected, Limited Device Configuration • Because the KVM has to be so much smaller than a J2SE JVM, some features are missing • CLDC provides core packages

More Related