Package de.xima.fc.io

Class TempFile

java.lang.Object
de.xima.fc.io.TempFile
All Implemented Interfaces:
Serializable, AutoCloseable

public final class TempFile extends Object implements AutoCloseable, Serializable
An AutoCloseable wrapper for a File that deletes that file when closed.
Author:
XIMA MEDIA GmbH
See Also:
  • Constructor Details

    • TempFile

      public TempFile(File file)
      Creates a new temp file. The given file will be deleted when this instance if closed.
      Parameters:
      file - File to wrap.
    • TempFile

      public TempFile(Path file)
      Creates a new temp file. The given file will be deleted when this instance if closed.
      Parameters:
      file - File to wrap.
  • Method Details

    • getFile

      public File getFile()
      Returns:
      The wrapped file.
    • getPath

      public Path getPath()
      Returns:
      The wrapped file.
    • close

      public void close() throws Exception
      Specified by:
      close in interface AutoCloseable
      Throws:
      Exception