jsr75 如何向文件尾追加数据?
码工码工 2008-03-03 05:19:20 /**
* 创建并保存文件
*
* @param fileDate 要写入文件的内容 一次性传过文件全部内容
* return 1: 成功
* return 2: 失败
* 2008-2-21 下午02:18:41
*/
public int creatFile (byte[] fileDate) {
int ret = 2;
try {
FileConnection fc = (FileConnection)Connector.open(path);
if (fc.exists()) {
//这里如何实现向文件尾追加数据?
} else {
fc.create();
fc.setWritable(true);
OutputStream os = fc.openDataOutputStream();
os.write(fileDate);
os.close();
fc.close();
ret = 1;
}
return ret;
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return ret;
}
}