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;
}
}
...全文
46 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
码工码工 2008-03-04
  • 打赏
  • 举报
回复
啊,没人知道啊,顶起来行。

13,100

社区成员

发帖
与我相关
我的任务
社区描述
Java J2ME
社区管理员
  • J2ME社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧