Class FileGarbageCan


  • public class FileGarbageCan
    extends java.lang.Object
    Represents files that need to be deleted after a program completes. Files may be added to the can throughout program execution through a call to add, and may be deleted by a call to empty before the program terminates.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void add​(java.io.File trash)
      Add a file to the trash can.
      static void add​(java.lang.String trash)
      Add a file to the trash can.
      static void empty()
      Deletes all of the files in the trash can.
      • Methods inherited from class java.lang.Object

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

      • add

        public static void add​(java.io.File trash)
        Add a file to the trash can.
        Parameters:
        trash - File to be deleted
      • add

        public static void add​(java.lang.String trash)
        Add a file to the trash can.
        Parameters:
        trash - File to be deleted
      • empty

        public static void empty()
        Deletes all of the files in the trash can. This method uses the deleteOnExit() method from File, so the files will not actually be deleted until the JVM exits.
        See Also:
        File