Virtual file system

Virtual root directories provide another choice for getting direct access to common directories. A virtual root directory maps to the particular physical directory. For example, the Images virtual root directory maps to the data\Images\ directory. A FileConnection.list() operation returns virtual root directories if the connection has been established using a virtual root. A FileSystemRegistry.listRoots() operation returns both virtual and physical roots. For example, c:/ and e:/ are physical roots. The corresponding virtual roots are Internal/ and Memory card/. Virtual root directories map to the same directories that are defined in File API System properties.

File API localizes virtual roots and root directories. File API can always convert (no matter what language the device uses) roots and root directories written in English to the corresponding physical drives or paths. Therefore, English is the recommended language for hard-coded paths in MIDlets.

The table below contains the reserved names of virtual roots and the directories that can be used in the hard-coded paths.

In case of the virtual file system, English and “local” languages cannot be mixed in the URI. E.g. file:///Internal/Kuvat/ is not a valid URI. Note: “Kuvat” is Finnish and means “Images” in English.

The FileConnection.list() operation returns virtual directories in the language corresponding to the one used in the creation of the connection (that is, the language of the virtual root). E.g. FileConnection.list() operation of the file:///Internal/ connection returns virtual directories in English.

Table: Reserved names of virtual roots and directories

Reserved name

Description of purpose

Internal

Virtual root. Points to the phone memory root. For example, c:.

Temporary

Virtual root. Points to the temporary data drive. For example, d:. Note: Usage of this root is only allowed if MIDlet uses “Manufacturer” access domain.

Memory card

Virtual root. Points to the root of the default memory card. For example, e:.

Hard drive

Virtual root. Points to the root of the hard drive. For example, f:.

Internal X

Virtual root. Points to the root of an additional phone memory drive. For example, if g: is an additional phone memory drive, the name is 'Internal G'.

Memory card X

Virtual root. Points to the root of a secondary memory card. For example, if h: is a secondary memory card, the name is 'Memory card H'.

Rom

Virtual root. Points to the rom data. For example, z:. Note: Usage of this root is only allowed if MIDlet uses “Manufacturer” access domain.

Images

Virtual directory. Points to the “Images” directory. For example, /data/Images/.

Videos

Virtual directory. Points to the “Videos” directory. For example, /data/Videos/.

Graphics

Virtual directory. Points to the “Pictures” directory. For example, /data/Images/Pictures/.

Sounds

Virtual directory. Points to the “Sounds” directory. For example, /data/Sounds/.

Music

Virtual directory. Points to the “Sounds” directory. For example, /data/Sounds/.

Recordings

Virtual directory. Points to the “Digital” directory. For example, /data/Sounds/Digital/.

Private

Virtual directory. Points to the private work directory of a MIDlet suite. For example, /private/102033e6/midlets[1015b77b]/scratch.

Example 1:

//connection established using physical root
FileConnection conn = (FileConnection) Connector.open("file:///c:/");
Enumeration enum = conn.list();
//the list() operation returns the following physical directory: "data/"

Example 2:

//connection established using virtual root
FileConnection conn = (FileConnection) Connector.open("file:///Internal/");
Enumeration enum = conn.list();
// the list() operation returns the following virtual root directories: "Images",
 "Videos", "Graphics", "Sounds", "Music" and "Recordings"