RandomAccessFile
provides random access to the data in a
file.
RandomAccessFile
objects are obtained by calling the
open
method on a File object.
A RandomAccessFile
have both asynchronous and synchronous
methods. The asynchronous methods all return a Future
whereas the synchronous methods will return the result directly,
and block the current isolate until the result is ready.
At most one asynchronous method can be pending on a given RandomAccessFile
instance at the time. If an asynchronous method is called when one is
already in progress a FileSystemException is thrown.
If an asynchronous method is pending it is also not possible to call any synchronous methods. This will also throw a FileSystemException.
Future
that
completes when it has been closed.
Future<RandomAccessFile>
that completes with this
RandomAccessFile when the flush operation completes.
Future<int>
that
completes with the length in bytes.
Future<int>
that completes with the position.
bytes
bytes from a file and returns the result as a list of bytes.
Future<int>
that
completes with the byte, or with -1 if end-of-file has been reached.
start
is present,
the bytes will be filled into buffer
from at index start
, otherwise
index 0. If end
is present, the end
- start
bytes will be read into
buffer
, otherwise up to buffer.length
. If end
== start
nothing
happens. [...]
start
is present, the bytes will be filled into buffer
from at index start
,
otherwise index 0. If end
is present, the end
- start
bytes will be
read into buffer
, otherwise up to buffer.length
. If end
== start
nothing happens. [...]
bytes
bytes from a file and
returns the result in a list of bytes. [...]
Future<RandomAccessFile>
that completes with this
RandomAccessFile when the position has been set.
length
bytes. Returns a
Future<RandomAccessFile>
that completes with this
RandomAccessFile when the truncation has been performed.
length
bytes. [...]
Future<RandomAccessFile>
that completes with this
RandomAccessFile when the write completes.
start
to index end
. If start
is omitted, it'll start from index 0.
If end
is omitted, it will write to end of buffer
. [...]
start
to index end
. If start
is omitted, it'll
start from index 0. If end
is omitted, it will write to the end of
buffer
. [...]
Future<RandomAccessFile>
that completes with this
RandomAccessFile when the write completes.