MIDP applications have to run seamlessly on many devices. You've already seen how this can be a challenge in the user-interface arena. The trick there was to use abstract concepts that would be mapped to the screen by a device-specific implementation.
MIDP's approach to persistent storage is basically the same. Your application could run on a MID with flash ROM, battery-backed RAM, or even a small hard disk. MIDP applications don't really care; all they know about are small databases called record stores. It's up to the device's MIDP implementation to map record stores in some reasonable manner to whatever persistent storage is available.
These are small amounts of data we're talking about; the MIDP specification dictates that the minimum amount of persistent storage is only 8KB.
Persistent storage in MIDP is centered around record stores. A record store is a small database that contains pieces of data called records. Record stores are represented by instances of javax.microedition.rms.RecordStore. The scope of a record store is limited to a single MIDlet suite. Said another way, a MIDlet can only access record stores that were created by a MIDlet in the same suite. Figure 7-1 shows the relationship between MIDlet suites and record stores.
Figure 7-1: RecordStores belong to MIDlet suites.
Record stores are identified by a name. Within a MIDlet suite's record stores, the names must be unique.
Team-Fly |