OkioFilesystemGateway

class OkioFilesystemGateway(fileSystem: FileSystem, basePath: String) : FilesystemGateway

FilesystemGateway implementation backed by okio.FileSystem.

Defaults to FileSystem.SYSTEM; tests can swap in FakeFileSystem.

Constructors

Link copied to clipboard
constructor(fileSystem: FileSystem, basePath: String)

Functions

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

Create path (and any missing parents) inside the sandbox.

Link copied to clipboard
open suspend override fun findFilesByGlob(path: String, pattern: String): List<String>

Find every file under path whose relative path matches the glob pattern.

Link copied to clipboard
open suspend override fun findFilesContaining(path: String, pattern: String): List<String>

Find every text file under path whose contents match the regex pattern.

Link copied to clipboard
open suspend override fun findLinesMatching(path: String, fileName: String, pattern: String): List<LineMatch>

Find every line in path/fileName whose content matches pattern.

Link copied to clipboard
open suspend override fun listAllFiles(path: String): List<String>

Recursive listing of every file under path (relative paths).

Link copied to clipboard
open suspend override fun ls(path: String): List<String>

Non-recursive listing of path (paths returned relative to the base).

Link copied to clipboard
open suspend override fun read(path: String, fileName: String): String

Read the full UTF-8 text contents of path/fileName.

Link copied to clipboard
open suspend override fun write(path: String, fileName: String, content: String)

Replace the contents of path/fileName with content (UTF-8).