Java Reference
In-Depth Information
CHAPTER 9
■ ■ ■
Persistent Storage II:
File Connection and PIM API
B eyond the typically small persistent storage managed by MIDP's record store mechanism,
devices may have additional persistent data storage mechanisms that can be made available to
J2ME applications.
JSR 75 addresses two such mechanisms: file systems and Personal Information Management
(PIM) databases.
Large file systems can be found on devices that accept plug-in flash memory cards. The
File Connection Optional Package provides an API to access these file systems.
PIM databases, such as phone directories and to-do lists, are managed by some devices
natively. The PIM Optional Package provides an API for J2ME applications to access these
PIM databases.
File Connection Optional Package
Modern devices may have slots for optional flash memory cards (maybe even small hard disks) that
can be added. Common flash memory card formats include Secure Data (SD) cards, Compact
Flash, and Memory Stick. These memory cards can expand the available persistent storage to
megabytes or even gigabytes of data. The record store mechanism of MIDP is inefficient for
handling such large-capacity storage. The persistent storage on these cards is accessed as a file
system, instead of a database, with directories and files.
A device may expose its file systems through the File Connection Optional Package. This
optional API is contained in the javax.microedition.io.file package. Much like with a desktop
PC, you can read or write files, and you can create or remove directories on the exposed file
system. The file systems exposed by this API are usually fairly large in size, from megabytes to
gigabytes large.
This optional package is implemented on top of CLDC. The API requires only CLDC 1.0,
and works also with CLDC 1.1. The relationship between the File Connection Optional Package
and CLDC is illustrated in Figure 9-1.
117
Search WWH ::




Custom Search