ReadOnly

interface ReadOnly<Path>(source)

Provides operations for path serialization, structure navigation, and content reading in a read-only manner without modifying the filesystem.

Inheritors

Functions

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

Checks if a path exists in the filesystem.

Link copied to clipboard
abstract fun extension(path: Path): String

Gets the extension of a path. This method works with the path structure and doesn't check if the path actually exists in the filesystem.

Link copied to clipboard

Filters the current read-only file system implementation such that only paths that are accepted by filter are visible and accessible.

Link copied to clipboard
abstract fun fromAbsolutePathString(path: String): Path

Creates a Path object from an absolute path string. This method works with the path structure and doesn't check if the path actually exists in the filesystem.

Link copied to clipboard

Detects the type of content stored in a file using a path.

Link copied to clipboard
abstract suspend fun inputStream(path: Path): Source

Creates a Source for reading from a file at the specified path. The returned Source is buffered.

Link copied to clipboard
abstract fun joinPath(base: Path, vararg parts: String): Path

Resolves strings from parts against a base path. This method works with the path structure and doesn't check if the path actually exists in the filesystem.

Link copied to clipboard
abstract suspend fun list(directory: Path): List<Path>

Lists contents of a directory. Children are sorted by name. The listing is not recursive.

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

Retrieves metadata for a file or directory using a path.

Link copied to clipboard
abstract fun name(path: Path): String

Gets the name component of a path. This method works with the path structure and doesn't check if the path actually exists in the filesystem.

Link copied to clipboard
abstract fun parent(path: Path): Path?

Gets the parent path of a given path. This method works with the path structure and doesn't check if the path actually exists in the filesystem.

Link copied to clipboard
abstract suspend fun readBytes(path: Path): ByteArray

Reads the content of a file at the specified path.

Link copied to clipboard

Reads the entire content of a file as a string.

Link copied to clipboard
abstract fun relativize(root: Path, path: Path): String?

Computes the relative path from a root to a target path. It doesn't check if the paths actually exist in the filesystem.

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

Gets the size of a file in bytes.

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

Converts a path to its absolute path string representation. This method works with the path structure and doesn't check if the path actually exists in the filesystem.