Example usage for java.io DeleteOnExitHook add

List of usage examples for java.io DeleteOnExitHook add

Introduction

In this page you can find the example usage for java.io DeleteOnExitHook add.

Prototype

static synchronized void add(String file) 

Source Link

Usage

From source file:org.dhatim.archive.Archive.java

private void createTempDir() {
    if (tmpDir == null) {
        try {/*w  w  w. j av a  2  s.c  om*/
            File tmpFile = File.createTempFile("tmp", "tmp");

            tmpFile.delete();
            tmpDir = new File(tmpFile.getParentFile(), UUID.randomUUID().toString());
            DeleteOnExitHook.add(tmpDir);

        } catch (IOException e) {
            throw new SmooksException("Unable to crete temp directory for archive.", e);
        }
    }
}