开发者

Question about RandomAccessFile in Java?

I am reading some Java text about RandomAccessFile, in the text, the author says:

RandomAccessFile(File file, String mode)
  • Mode “r” to open the file for reading only

    Mode “rw” to open for both reading and writing

    Mode “rws” is same as rw and any changes to the file’s cont开发者_开发问答ent or metadata take place immediately (since java 5)

    Mode “rwd” is same as rw, and changes to the file content, but not its metadata, take place immediately (since java 5)

I am not sure that I understand the difference between “rws” and “rwd”. I have tried to run some related code but did not see any points?

Can anyone have a clear example, please?


File metadata in Java is explained here. An example of metadata that might not be updated immediately with "rwd" mode would be if you set the file modification time by calling Files.setLastModifiedTime(file, time).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜