Java:RandomAccessFile模式“rws”vs“rwd”?

前端之家收集整理的这篇文章主要介绍了Java:RandomAccessFile模式“rws”vs“rwd”?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
RandomAccessFile constructor接受一个指定文件应如何打开的模式字符串.

我对“rws”和“rwd”模式之间的区别感到困惑.

这是docs的状态:

“rws” Open for reading and writing,as with “rw”,and also require
that every update to the file’s content or Metadata be written
synchronously to the underlying storage device.

“rwd” Open for reading and writing,and also require
that every update to the file’s content be written synchronously to
the underlying storage device.

[…]

The “rwd” mode can be used to reduce the number of I/O operations
performed. Using “rwd” only requires updates to the file’s content to
be written to storage; using “rws” requires updates to both the file’s
content and its Metadata to be written,which generally requires at
least one more low-level I/O operation.

…并没有解释什么元数据的意思.这是否意味着“rws”会更新文件系统上最后修改的时间戳,而“rwd”不会更新?

解决方法

Does it mean that “rws” updates the last modified timestamp on the filesystem,and “rwd” doesn’t ?

rws刷新文件内容文件修改日期.

rwd刷新文件内容,但修改日期可能不会更改,直到文件关闭.

rw只有当你告诉它并且不改变修改日期直到你关闭文件才会刷新.

BTW rwd对于写入速度比rw慢得多,rws再次变慢.

猜你在找的Java相关文章