Static fromConstructs RandomAccessSource from the given byte array.
The byte array to use as the source.
RandomAccessSource instance that provides random access to the byte array data.
Static fromConstructs RandomAccessSource from the given file effectively creating a memory-mapping.
Path to the file.
RandomAccessSource instance that provides random access to the file data.
RandomAccessSource is a wrapper around a native memory-mapped file or byte array. It is used to provide a random access interface to the underlying data.
Example
Since the instance of the class is backed by native resources and implements
AsyncDisposableit's highly recommended to use theawait usingsyntax when an instance is created or is received from an API:Alternatively, one can explicitly call dispose method to release the native resources. If neither is used, the resource will be released when the instance is garbage collected which is not recommended.