有一个笨的方法,
File te=new File( "c:\\winzip.log ");
te.setReadOnly();
...
File tempFile=new File ("c:\\temp.txt");(将te内容copy to tempFile)....
update tempFile
......
ts.delete()....File te=new File( "c:\\winzip.log ");
将tempFile内容copy to te小心使用这方法,以防数据丢。
我在此显丑了
File te=new File( "c:\\winzip.log ");
te.setReadOnly();
...
File tempFile=new File ("c:\\temp.txt");(将te内容copy to tempFile)....
update tempFile
......
ts.delete()....File te=new File( "c:\\winzip.log ");
将tempFile内容copy to te小心使用这方法,以防数据丢。
我在此显丑了
其实你copy的时候就有可能别人在写
数据照样不一致 虽然时间很短 但这个操作很频繁 会遇到这样的问题