我正在使用以下代码在 BlackBerry 模拟器上编写文本文件。我的数据已成功写入文件,但我无法找到我的文件。我在哪里可以找到模拟器上的文件?
public static void debug() {
OutputStream os = null;
FileConnection fc = null;
try {
String data = "Hello This is Yogesh working on blackberry";
Dialog.alert("TEST_1");
fc = (FileConnection)Connector.open("file:///SDCard/test.txt",Connector.READ_WRITE);
//fc = (FileConnection)Connector.open("file:///SDCard/BlackBerry/pictures/test.txt",Connector.READ_WRITE);
Dialog.alert("TEST_2");
//FileConnection fc = (FileConnection)Connector.open(System.getProperty("file:///SDCard/"+"test.txt"),Connector.READ_WRITE);
Dialog.alert("TEST_3");
if(!fc.exists()) {
Dialog.alert("TEST_31");
fc.create();
}
Dialog.alert("TEST_4");
os = fc.openOutputStream();
Dialog.alert("TEST_5");
os.write(data.getBytes());
Dialog.alert("TEST_6");
Dialog.alert("Data written successfully...!!!");
} catch(Exception e) {
Dialog.alert("Exception in writing logs :"+e);
} finally {
if(os != null) {
try {
os.close();
} catch(Exception e) { }
}
if(fc != null) {
try {
fc.close();
} catch(Exception e) { }
}
}