Motorola E680 - Smartphone - GSM Developer's Manual page 67

Micro edition (j2me) applications
Hide thumbs Also See for E680 - Smartphone - GSM:
Table of Contents

Advertisement

16
File System Access API
Sample for FileConnection Interface
import javax.microedition.io.*;
import com.motorola.io.*;
/*
*
Get a root of file system
*/
java.lang.String root = FileSystemRegistry.listRoots()[0];
/*
* Create a FileConnection object pointing to root directory
*/
FileConnection fc = null;
try {
Connector.open("file://"+root);
} catch (IOException ioe) { }catch (Security Exception se)
{}
}
/*
* Get available, used and total size of file system
*/
long availableSize = fc.availablesize();
long usedSize = fc.usedSize();
long totalSize = fc.totalSize();
/*
* Determine the size in bytes that is used by a directory
*/
try {
} catch (IOException ioe) {
}
/*
* Get list of files in root
*/
java.lang.String list[] = fc.list();
/*
* Check if first item in the list is directory
*/
try {
+list[0]);
} catch (IOException ioe) {
67
fc = (FileConnection)
...
long rootSize = fc.directorySize(false);
...
fc = (FileConnection) Connector.open("file://"

Advertisement

Table of Contents
loading

Table of Contents