Kactoos

kactoos-jvm / nnl.rocks.kactoos.io / TempFile

TempFile

class TempFile : Scalar<Path>, Closeable

A temporary file.

These are ephemeral files to be used in small scopes. Typical use looks like this:

try (final TempFile file = new TempFile()) {
    //write to the file
}

The physical file is deleted from the filesystem when the temp file is closed.

Parameters

file - Creates the file and returns the path to it

Since 0.3

Constructors

Name Summary
<init> TempFile(prefix: String = "", suffix: String = "")
The temporary file will be created inside the filesystem’s temporary folder (system property: java.io.tmpdir).TempFile(dir: KScalar<Path>, prefix: String, suffix: String)
TempFile(dir: KScalar<Path>, prefix: Text, suffix: Text)

Functions

Name Summary
close fun close(): Unit
Deletes the file from the filesystem.
invoke fun invoke(): Path
Get value of this Scalar