Name

Package javax.microedition.rms

Synopsis

This package, whose class hierarchy is shown in Figure 17-1, allows MIDlets to store information on a device that will persist even when the MIDlet is not running. How the information is stored is device-specific and is not intended to be visible to MIDlets.

The key class in this package is RecordStore, which represents a collection of records. Each record in the record store is an array of bytes with an associated identifier. This identifier can be used to retrieve the record, modify it, or delete it. MIDlets in the same MIDlet suite can share record stores, but may not access (or even know of the existence of) record stores in other suites. All record stores belonging to a suite are automatically removed if the suite is removed from the device.

Records in a record store can be traversed by creating a RecordEnumeration. The enumeration may contain all of the records, or a subset filtered according to some MIDlet-defined criterion. The order in which the records appear in the enumeration can also be controlled through the use of a RecordComparator.

Get J2ME in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.