File Management API
To ensure data and file persistence on the device, an API is required to access, modify, and delete files locally from the device. To work with files and folders, the com.softwareag.mobile.md.io.File class is available.
Virtual file system
To provide a consistent way to work with files and directories on every mobile platform, a virtual file system is introduced. Every root folder of the virtual fily system is mapped to the best suited folder on the device.
Path separator
For separating folders, a slash symbol (“/”) is used.
Root folders
The root of the virtual file system is “/”. It contains the following root folders:
documents: for reading and writing access
resources: for reading access only
cache: for reading and writing access. The folder can be cleaned by system.
external_storage: for reading and writing access on external storage
Valid characters for file and directory names
To avoid inconsistency between different platforms, the acceptable characters are reduced to the following:
letters: A-Z, a-z
digits: 0-9
symbols: [-._]
If you use any other character, an IllegalArgumentException is thrown. However, the list() method can return names with any symbols that the particular native file system allows. As a result, the method cannot be used to construct new file instances. To operate such files, you can use the listFiles() method.
Android root folders mapping
documents: mapped to
/files cache: mapped to
/cache resources: mapped to the
Android Asset folder
external_storage: mapped to the external SD card if it exists. Additional permissions might be needed.
iOS root folder mapping
documents: mapped to
/Documents/ cache: mapped to
/Library/Caches resources: mapped to
[AppName.app] external_storage: is not mapped.