Featureful / src / main / kotlin / uk / co / nickthecoder / featureful / TempFile.kt
package uk.co.nickthecoder.featureful import java.io.File /** * Creates a temporary file which will be deleted when this instance is garbage collected, * or the application ends. */ class TempFile(prefix: String, suffix: String) { val file = File.createTempFile(prefix, suffix) protected fun finalize() { if (file.exists()) { file.delete() } } }