The difference between atitit. RandomAccessFile rws rwd and rwsrwd
Difference between atitit. RandomAccessFile rws rwd
1. Rw rws rwd1
2. "rws" Mode 1
3. rwd "Mode 2
1. Rw rws rwd
"R" is opened in read-only mode. Any write method that calls the result object will throw an IOException.
"Rw" is enabled for reading and writing.
"Rws" is enabled for reading and writing. Compared with "rw", "rws" requires that each update of "file content" or "metadata" be synchronized to the basic storage device.
"Rwd" is enabled for reading and writing. Compared with "rw", "rwd" requires that each update of "file content" be synchronized to the basic storage device.
Author: nickname: old wow's paw (full name: Attilax Akbar Al Rapanui Attila Akba Arla Panui) Name: AI long, EMAIL: 1466519819@qq.com
Reprinted please indicate Source: http://www.cnblogs.com/attilax/
2. "rws" Mode
The s in Rws Mode means synchronously synchronization...
By default (in rw mode), the buffer is used. Only when the cache is full or the RandomAccessFile. close () is used to close the stream can the file be actually written...
There are two problems:
1. debugging is troublesome... ------------------ when you use the write method to modify byte, you only need to modify it to a memory LAN, but not to a file. The flash debugging is troublesome. You cannot use the notepad ++ tool to immediately see the modification effect ..
2. When the system halt is used, it cannot be written to a file... the security is slightly worse ....
The Rws mode is the synchronization mode. Each write modifies a byte and writes it to the disk immediately .. of course, the intermediate performance is worse, suitable for small files... and debug mode... or when high security is needed...
3. rwd Mode
The Rwd mode is the same as the rws mode. However, only the "file content" is synchronously updated to the disk... the metadata is not synchronously updated ..
This mode is in the middle of rw and rws ....