Atitit. RandomAccessFile & #160; rws & #160; rwd & #160;

Source: Internet
Author: User

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 ....

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.