tuweni / org.apache.tuweni.io.file / Files

Files

class Files (source)

Utility methods for working with files.

Functions

atomicReplace

Write a temporary file and then replace target.

static fun atomicReplace(path: Path!, bytes: ByteArray!): Unit
static fun atomicReplace(path: Path!, fn: IOConsumer<Writer!>!): Unit
static fun atomicReplace(path: Path!, charset: Charset!, fn: IOConsumer<Writer!>!): Unit

copyResource

Copies the content of a resource to a file.

static fun copyResource(resourceName: String!, destination: Path!, vararg options: OpenOption!): Path!
static fun copyResource(classloader: ClassLoader!, resourceName: String!, destination: Path!, vararg options: OpenOption!): Path!

Copies the content of a resource to an output stream.

static fun copyResource(resourceName: String!, out: OutputStream!): Long
static fun copyResource(classloader: ClassLoader!, resourceName: String!, out: OutputStream!): Long

createFileIfMissing

Create a file, if it does not already exist.

static fun createFileIfMissing(path: Path!, vararg attrs: FileAttribute<*>!): Boolean

deleteRecursively

Delete a directory and all files contained within it.

static fun deleteRecursively(directory: Path!): Unit