RandomAccessFile
constructor接受一个指定文件应如何打开的模式字符串.
我对“rws”和“rwd”模式之间的区别感到困惑.
这是docs的状态:
@H_403_6@“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.