ReadOnly

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

Functions

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

Checks if the specified file or directory exists at the given path.

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

Retrieves the extension of the specified path.

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
open override fun fromAbsolutePathString(path: String): Path

Converts the given absolute file path string to a normalized Path object.

Link copied to clipboard
open suspend override fun getFileContentType(path: Path): FileMetadata.FileContentType

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

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

Creates a Source for reading from a file at the specified path. The returned Source is buffered. It is created with Dispatchers.IO context.

Link copied to clipboard
open override 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
open suspend override fun list(directory: Path): List<Path>

Retrieves a sorted list of paths within the specified directory. The listing is not recursive.

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

Retrieves metadata for a given file or directory path.

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

Retrieves the name of the given file path.

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

Retrieves the parent directory of the specified path, if it exists.

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

Reads the content of a file at the specified path. Bytes are read with Dispatchers.IO context.

Link copied to clipboard

Reads the entire content of a file as a string.

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

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

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

Returns the size of the regular file at the specified path.

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

Converts the given path to its absolute path representation as a string. The path is normalized before being converted.