开发者

Lock file for writing? [duplicate]

This question already has answers here: Closed 11 years ago. 开发者_开发技巧

Possible Duplicate:

How can I lock a file using java (if possible)

Is it possible to lock file so that other apps cannot write to file but can still run it normally? My target platform is windows.


File yourFile = new File("yourFile.txt");

yourFile.setWritable(false);


Look at FileChannel's lock() API.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜