Skip to main content

how to use file:// protocol to access directory

1 reply [Last post]
george_ustc
Offline
Joined: 2008-08-26
Points: 0

I checked MR3 JAMS support file:// protocol to install a midlet. but it seems they don't provide function to allow user access a directory. Does somebody know if the protocol file:// support browser a directory?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
romanz
Offline
Joined: 2006-10-16
Points: 0

To access anything in the device file system via file:// protocol, JSR-75 FileConnection is used. The JSR is able to restrict file system access, i.e. not show the entire directory structure to Java applications. Typically, the first thing a MIDlet should do before attempting to access any directory (after verifying that JSR-75 is present), is a call to javax.microedition.io.file.FileSystemRegistry.listRoots(), which tells what virtual file system roots are accessible to the application. For an example of FileConnection usage, you can check the FileBrowser MIDlet in PDAPDemo suite from Sun Java Wireless Toolkit (version 2.5.2 is available at http://java.sun.com/products/sjwtoolkit/download.html).

For more details on the FileConnection API, please see the specification at http://www.jcp.org/en/jsr/detail?id=75

Regards,
Roman