kactoos-jvm / nnl.rocks.kactoos.io / 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.


file - Creates the file and returns the path to it

Since 0.3


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)


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