Request that all updates to the channel are committed to the storage device.
When this method returns all modifications made to the platform file underlying this channel will be committed to a local storage device. If the file is not hosted locally, such as 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 indicated 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.
@param metadata true if the file metadata should be flushed in addition to the file content, and false otherwise.
@throws ClosedChannelException if the channel is already closed.
@throws IOException some other problem occured.