- 论坛徽章:
- 0
|
1. 遍历手机的根目录
Enumeration enumer = FileSystemRegistry.listRoots();
String root = null;
while(enumer.hasMoreElements()){
root = (String)enumer.nextElement();
append(root+"\n");
}
2. 访问指定路径的文件
FileConnection fconn = (FileConnection)Connector.open("file:///存储卡/dialer.txt",Connector.READ);
if (fconn.exists()){
DataInputStream dataIn = fconn.openDataInputStream();
int fileSize = (int)fconn.fileSize();
byte[] data = new byte[fileSize];
dataIn.read(data,0,fileSize);
append(new String(data));
}else
append("file:///存储卡/dialer.txt not exist!");
fconn.close();
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/20181/showart_1893831.html |
|