Do the operations in java.nio.files.Files sync or not?
Tim Fox
timvolpe at gmail.com
Tue Aug 2 01:40:55 PDT 2011
On 02/08/11 09:34, Alan Bateman wrote:
> Tim Fox wrote:
>> Hello all,
>>
>> I'm looking at the javadoc for the new Files class in Java 7:
>>
>> http://download.oracle.com/javase/7/docs/api/
>>
>> For the operations that make changes on disk, it's not clear to me if
>> the changes are automatically sync'd to disk or not before the
>> operation completes. There don't seem to be any parameters to control
>> this.
>>
>>
>>
>> Can anyone advise?
>>
>> Thanks
> The "Synchronized I/O File Integrity" section in the package javadoc
> is where this is discussed. Basically you use the SYNC or DSYNC
> options when opening files to indicate that the file content should be
> written synchronously to the disk. FileChannel also defines the force
> method.
Sure, I understand how to force sync when using FileChannels or using
streams, but the question is on the methods in the class java.nio.file.Files
For example, the setAttribute method. Is the changed file meta data
synced to disk before the method returns or not? It's not mentioned in
the javadoc.
>
> -Alan.
More information about the nio-discuss
mailing list