JavaModelFileSystem

ModelFileSystem backed by java.io / java.nio (Android API 26+ and JVM desktop).

Functions

Link copied to clipboard
open override fun atomicMove(source: String, target: String)

Moves source to target, replacing target. Atomic when both are on the same volume, so readers never see a partially written target.

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

Creates path and any missing parent directories.

Link copied to clipboard
open override fun delete(path: String): Boolean

Deletes the file at path. Returns false if it did not exist.

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

Whether a file or directory exists at path.

Link copied to clipboard
open override fun lastModifiedMillis(path: String): Long

Last modification time in epoch milliseconds, or 0 if unknown.

Link copied to clipboard
open override fun list(directory: String): List<String>

Names (not paths) of the regular files directly inside directory; empty if it does not exist.

Link copied to clipboard
open override fun openAppend(path: String, truncate: Boolean = false): FileSink

Opens path for appending, creating it if needed; with truncate it is emptied first.

Link copied to clipboard
open override fun openRead(path: String): ModelByteSource

Opens path for random-access reading.

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

Size of the regular file at path in bytes, or -1 if it does not exist.