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.
Reserved name |
Description of purpose |
---|---|
Internal |
Virtual root. Points to the phone memory root. For example, |
Temporary |
Virtual root. Points to the temporary data drive. For example, |
Memory card |
Virtual root. Points to the root of the default memory card. For example, |
Hard drive |
Virtual root. Points to the root of the hard drive. For example, |
Internal X |
Virtual root. Points to the root of an additional phone memory drive.
For example, if |
Memory card X |
Virtual root. Points to the root of a secondary memory card. For example,
if |
Rom |
Virtual root. Points to the rom data. For example, |
Images |
Virtual directory. Points to the “Images” directory. For example, |
Videos |
Virtual directory. Points to the “Videos” directory. For example, |
Graphics |
Virtual directory. Points to the “Pictures” directory. For example, |
Sounds |
Virtual directory. Points to the “Sounds” directory. For example, |
Music |
Virtual directory. Points to the “Sounds” directory. For example, |
Recordings |
Virtual directory. Points to the “Digital” directory. For example, |
Private |
Virtual directory. Points to the private work directory of a MIDlet
suite. For example, |
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"