- java.lang.Object
-
- com.aoapps.tempfiles.TempFile
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public class TempFile extends Object implements Closeable
A temporary file that is deleted whenclosedor when its associatedTempFileContextisclosed.Thread-safe with fine-grained locking.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the temporary file, de-registering from delete on exit and deleting the underlying file.FilegetFile()Gets the temporary file.
-
-
-
Method Detail
-
getFile
public File getFile() throws IllegalStateException
Gets the temporary file.- Throws:
IllegalStateException- when already closed
-
close
public void close() throws IOExceptionCloses the temporary file, de-registering from delete on exit and deleting the underlying file.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
-