Package com.aoindustries.io
Class TempFile
- java.lang.Object
-
- com.aoindustries.io.TempFile
-
@Deprecated public class TempFile extends Object
Deprecated.Please useTempFileContextasFile.deleteOnExit()is prone to memory leaks in long-running applications.Holds a reference to a temp file. Automatically deletes the file with a finalizer, on JVM shutdown, or whendelete()is explicitly called.- Author:
- AO Industries, Inc.
- See Also:
for a way to confine instance lifetime to a narrower scope than automatic garbage collection
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voiddelete()Deprecated.Deletes the underlying temp file immediately.protected voidfinalize()Deprecated.The finalization mechanism is inherently problematic.FilegetFile()Deprecated.Gets the temp file.StringtoString()Deprecated.
-
-
-
Constructor Detail
-
TempFile
public TempFile(String prefix) throws IOException
Deprecated.- Throws:
IOException
-
TempFile
public TempFile(String prefix, String suffix) throws IOException
Deprecated.- Throws:
IOException
-
TempFile
public TempFile(String prefix, String suffix, File directory) throws IOException
Deprecated.Creates the temp directory if missing.- Throws:
IOException
-
-
Method Detail
-
delete
public void delete() throws IOExceptionDeprecated.Deletes the underlying temp file immediately. Subsequent calls will not delete the temp file, even if another file has the same path. If already deleted, has no effect.- Throws:
IOException
-
finalize
@Deprecated protected void finalize() throws Throwable
Deprecated.The finalization mechanism is inherently problematic.Deletes the underlying temp file on garbage collection.
-
getFile
public File getFile() throws IllegalStateException
Deprecated.Gets the temp file.- Throws:
IllegalStateException- if already deleted
-
-