Java Reference
In-Depth Information
Chapter 5. Data Persistency
IN THIS CHAPTER
RMS Basics
Basic Functionality of the Class RecordStore
A Simple Diary Application Using RMS
Record Listeners
Storing Custom Objects
Ordered Traversal: Comparators and Record Enumerations
The Search Problem
Mobile devices such as cellular phones or PDAs normally don't have a file system available like
that found on desktop computers. However, these devices still provide a mechanism to store data
persistently. This mechanism is based on memory techniques such as flash memory. These
techniques provide an advantage in that the head-positioning times associated with disk-based
media are avoided. Thus, a more appropriate system based on random record access instead of
sequential file reading is provided for these devices. For access to this record system, PDAP and
MIDP contain the Record Management System (RMS).
RMS Basics
The RMS API is contained in the package javax.microedition.rms . A MIDlet can create
and access a number of record stores. Each record store has a name that is unique in the MIDlet
suite. It consists of a number of variable-length records. The records themselves are simple byte
arrays without any further predefined structure.
The RMS API does not include routines for integrity maintenance. All maintenance is performed
by the platform automatically.
MIDlets can access record stores of other MIDlets only if they are in the same MIDlet suite. For
instance, it is possible to include a MIDlet A inside MIDlet suite 1 and include a MIDlet B in
MIDlet suite 2. Although both MIDlet suites are on the same device, MIDlet A is not allowed to
manipulate the log or diary information of MIDlet B because it's in a different suite. Figure 5.1
shows how the RMS maintains multiple records stores of different MIDlets.
Figure 5.1. The record store's visibility and structure.
 
 
 
Search WWH ::




Custom Search