Java.Nio.Channels.FileChannel.Force Method
Requests that all updates to this channel are committed to the storage device.

Syntax

[Android.Runtime.Register("force", "(Z)V", "GetForce_ZHandler")]
public abstract void Force (bool metadata)

Parameters

metadata
true if the file metadata should be flushed in addition to the file content, false otherwise.

Exceptions

TypeReason
Java.Nio.Channels.ClosedChannelExceptionif this channel is already closed.
Java.IO.IOExceptionif another I/O error occurs.

Remarks

Requests that all updates to this channel are committed to the storage device.

When this method returns, all modifications made to the platform file underlying this channel have been committed if the file resides on a local storage device. If the file is not hosted locally, for example on a networked file system, then applications cannot be certain that the modifications have been committed.

There are no assurances given that changes made to the file using methods defined elsewhere will be committed. For example, changes made via a mapped byte buffer may not be committed.

The metadata parameter indicates whether the update should include the file's metadata such as last modification time, last access time, etc. Note that passing true may invoke an underlying write to the operating system (if the platform is maintaining metadata such as last access time), even if the channel is opened read-only.

[Android Documentation]

Requirements

Namespace: Java.Nio.Channels
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1