Forces any updates to this channel's file to be written to the storage device that contains it.
Forces any updates to this channel's file to be written to the storage device that contains it.
Invoking this method might trigger an
fsync or fdatasync
operation, which transfers all modified in-core data of
the file to the disk device, so that all changed
information can be retrieved even after the system crashed
or was rebooted. If the writeMetaData
is set to true
,
then this would be the equivalent of an fsync
command,
or fdatasync
if set to false.
This method is only guaranteed to force changes that were made to this channel's file via the methods defined in this class.
if true
then this method is required
to force changes to both the file's content and metadata
to be written to storage; otherwise, it need only force
content changes to be written
is a callback to be called when the asynchronous operation succeeds, or for signaling errors
Returns true
if this channel is open, or false
otherwise.
Reads a sequence of bytes from this channel into the given buffer, starting at the given file position.
Reads a sequence of bytes from this channel into the given buffer, starting at the given file position.
is the buffer holding the bytes read on completion
is the position in the opened channel from where to read
is the callback to be called with the result, once this asynchronous operation is complete . For this method it signals the number of bytes read or -1 if the given position is greater than or equal to the file's size at the time the read is attempted.
Returns the current size of this channel's file, measured in bytes.
Writes a sequence of bytes to this channel from the given buffer, starting at the given file position.
Writes a sequence of bytes to this channel from the given buffer, starting at the given file position.
If the given position is greater than the file's size, at the time that the write is attempted, then the file will be grown to accommodate the new bytes; the values of any bytes between the previous end-of-file and the newly-written bytes are unspecified.
is the buffer holding the sequence of bytes to write
is the position in file where to write, starts from 0, must be positive
is the callback to be called with the result, once this asynchronous operation is complete . For this method it signals the number of bytes that were written
Forces any updates to this channel's file to be written to the storage device that contains it.
Forces any updates to this channel's file to be written to the storage device that contains it.
Invoking this method might trigger an
fsync or fdatasync
operation, which transfers all modified in-core data of
the file to the disk device, so that all changed
information can be retrieved even after the system crashed
or was rebooted. If the writeMetaData
is set to true
,
then this would be the equivalent of an fsync
command,
or fdatasync
if set to false.
This method is only guaranteed to force changes that were made to this channel's file via the methods defined in this class.
if true
then this method is required
to force changes to both the file's content and metadata
to be written to storage; otherwise, it need only force
content changes to be written
Reads a sequence of bytes from this channel into the given buffer, starting at the given file position.
Reads a sequence of bytes from this channel into the given buffer, starting at the given file position.
is the buffer holding the bytes read on completion
is the position in the opened channel from where to read
the number of bytes read or -1 if the given position is greater than or equal to the file's size at the time the read is attempted.
Returns the current size of this channel's file, measured in bytes.
Writes a sequence of bytes to this channel from the given buffer, starting at the given file position.
Writes a sequence of bytes to this channel from the given buffer, starting at the given file position.
If the given position is greater than the file's size, at the time that the write is attempted, then the file will be grown to accommodate the new bytes; the values of any bytes between the previous end-of-file and the newly-written bytes are unspecified.
is the buffer holding the sequence of bytes to write
is the position in file where to write, starts from 0, must be positive
the number of bytes that were written
An asynchronous channel for reading, writing, and manipulating a file.
On the JVM this is a wrapper around java.nio.channels.AsynchronousFileChannel (class available since Java 7 for doing async I/O on files).