参数“地址”是字符串“CepVizyonVersionFile”和Connector.openDataInputStream(address)
之后该程序引发与消息的异常:在网址:保存并读取流文件在BlackBerry
没有'。
应该填写什么格式?
public void saveLocal(String fileString, String address) {
try {
DataOutputStream fos = Connector.openDataOutputStream(address); //openFileOutput(address);
fos.write(fileString.getBytes());
fos.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public String readLocal(String address, int lenght) {
byte[] buffer = new byte[lenght];
byte[] buffer2;
String str = new String();
try {
DataInputStream fis = Connector.openDataInputStream(address);
int lnght = fis.read(buffer);
buffer2 = new byte[lnght];
fis.close();
for (int i = 0; i < lnght; i++)
buffer2[i] = buffer[i];
str = new String(buffer2);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return str;
}
好的,如果我想为其他应用程序和用户创建文件,我应该怎么做? – atasoyh 2010-11-10 12:09:41
@atasoyh这听起来像一个独特的问题 - 在StackOverflow上为它打开一个新问题。 – 2010-11-10 16:54:33