Class AutoRemoveableFile

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.AutoCloseable, java.lang.Comparable<java.io.File>

    public class AutoRemoveableFile
    extends java.io.File
    implements java.lang.AutoCloseable
    Use this class in a try-with-resources block to automatically delete the referenced file when this goes out of scope.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static org.slf4j.Logger logger  
      private static long serialVersionUID  
      • Fields inherited from class java.io.File

        pathSeparator, pathSeparatorChar, separator, separatorChar
    • Constructor Summary

      Constructors 
      Constructor Description
      AutoRemoveableFile​(java.io.File parent, java.lang.String child)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      • Methods inherited from class java.io.File

        canExecute, canRead, canWrite, compareTo, createNewFile, createTempFile, createTempFile, delete, deleteOnExit, equals, exists, getAbsoluteFile, getAbsolutePath, getCanonicalFile, getCanonicalPath, getFreeSpace, getName, getParent, getParentFile, getPath, getTotalSpace, getUsableSpace, hashCode, isAbsolute, isDirectory, isFile, isHidden, lastModified, length, list, list, listFiles, listFiles, listFiles, listRoots, mkdir, mkdirs, renameTo, setExecutable, setExecutable, setLastModified, setReadable, setReadable, setReadOnly, setWritable, setWritable, toPath, toString, toURI, toURL
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • logger

        private static final org.slf4j.Logger logger
    • Constructor Detail

      • AutoRemoveableFile

        public AutoRemoveableFile​(java.io.File parent,
                                  java.lang.String child)
    • Method Detail

      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable