ReadWrite

Provides a combined object interface for performing both read and write file system operations.

ReadWrite implements the FileSystemProvider.ReadWrite interface, extending both read-only and write capabilities. By delegating to ReadOnly and Write objects, it provides comprehensive file system operations including reading, writing, serialization, and path manipulation.

Functions

Link copied to clipboard
open suspend override fun create(parent: Path, name: String, type: FileMetadata.FileType)

Creates a new file or directory within a specified parent directory.

Link copied to clipboard
open suspend override fun delete(parent: Path, name: String)

Deletes a child file or directory with the specified name from the parent directory.

Link copied to clipboard
open suspend override fun exists(path: Path): Boolean

Checks if a given path exists in the file system.

Link copied to clipboard
open suspend override fun extension(path: Path): String

Gets the extension of the file represented by the given path.

Link copied to clipboard
open override fun fromAbsoluteString(path: String): Path

Converts an absolute string path into a normalized Path object suitable for the current file system.

Link copied to clipboard
open override fun fromRelativeString(base: Path, path: String): Path

Resolves a relative path string against a given base path and normalizes the resulting path.

Link copied to clipboard
open suspend override fun list(path: Path): List<Path>

Lists all the paths under a specified directory or file path.

Link copied to clipboard
open suspend override fun metadata(path: Path): FileMetadata?

Retrieves the metadata associated with the specified file or directory.

Link copied to clipboard
open suspend override fun move(source: Path, target: Path)

Moves a file or directory from the source path to the target path.

Link copied to clipboard
open suspend override fun name(path: Path): String

Retrieves the name of the file or directory represented by the specified path.

Link copied to clipboard
open suspend override fun parent(path: Path): Path?

Retrieves the parent directory/path of the given path.

Link copied to clipboard
open suspend override fun read(path: Path): ByteArray

Reads the content of the file at the specified path.

Link copied to clipboard
open suspend override fun relative(root: Path, path: Path): String?

Computes the relative path from a given root path to the specified path.

Link copied to clipboard
open suspend override fun relativize(root: Path, path: Path): String?

Relativizes the given path path based on the specified root path. This function calculates the relative path from the root to the path.

Link copied to clipboard
open suspend override fun sink(path: Path, append: Boolean): Sink

Creates and returns a Sink for the given path. The Sink can be used to write data to the file or directory represented by the specified path.

Link copied to clipboard
open suspend override fun size(path: Path): Long

Retrieves the size of the file or directory at the specified path.

Link copied to clipboard
open suspend override fun source(path: Path): Source

Provides access to a data source represented by the given path.

Link copied to clipboard
open override fun toAbsolutePathString(path: Path): String

Converts the specified path to its absolute path represented as a string.

Link copied to clipboard
open override fun toPathString(path: Path): String

Converts the given path to its string representation. The method is deprecated and it is recommended to use toAbsolutePathString instead.

Link copied to clipboard
open suspend override fun write(path: Path, content: ByteArray)

Writes the specified content to the given path.