Class TemporaryFile

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public class TemporaryFile
    extends java.lang.Object
    implements java.io.Closeable
    A temporary file or directory. Wraps a file or directory and deletes it (recursively, if it is a directory) when closed.
    • Constructor Summary

      Constructors 
      Constructor Description
      TemporaryFile​(java.io.File file)
      Creates a new wrapper around the given file.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      java.io.File getFile()
      Obtains the file or directory this temporary file refers to.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TemporaryFile

        public TemporaryFile​(java.io.File file)
        Creates a new wrapper around the given file. The file or directory file will be deleted (recursively, if it is a directory) on close.
    • Method Detail

      • getFile

        public java.io.File getFile()
        Obtains the file or directory this temporary file refers to.
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException