Do the operations in java.nio.files.Files sync or not?

Tim Fox timvolpe at gmail.com
Tue Aug 2 02:06:59 PDT 2011


On 02/08/11 09:56, Alan Bateman wrote:
> Tim Fox wrote:
>> :
>>
>> 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.
> The API doesn't provide any guarantees on that.  Suggestions welcome 
> but any wording needs to take account of custom providers that are 
> unlikely to provide any guarantees.
Most of the operations in the Files class (at least) change file meta 
data, I would therefore expect there to be some way of specifying 
whether the changes should be synced to disk when invoking those methods.

Whether file meta data is synced or not is already supported when using 
file channels via the SYNC option in a platform independent way, is 
there any reason why the same approach hasn't be used in the Files 
class, or is this just an unfortunate omission?
>
> -Alan.



More information about the nio-discuss mailing list