Package libcore.io
Class DeleteOnExit
- java.lang.Object
-
- java.lang.Thread
-
- libcore.io.DeleteOnExit
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
-
Field Summary
-
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddFile(String filename)Schedules a file for deletion.static DeleteOnExitgetInstance()Returns our singleton instance, creating it if necessary.voidrun()Does the actual work.-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, parkFor$, parkUntil$, popInterruptAction$, pushInterruptAction$, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, unpark$, yield
-
-
-
-
Method Detail
-
getInstance
public static DeleteOnExit getInstance()
Returns our singleton instance, creating it if necessary.
-
addFile
public void addFile(String filename)
Schedules a file for deletion.- Parameters:
filename- The file to delete.
-
run
public void run()
Does the actual work. Note we (a) first sort the files lexicographically and then (b) delete them in reverse order. This is to make sure files get deleted before their parent directories.- Specified by:
runin interfaceRunnable- Overrides:
runin classThread- See Also:
Thread.start()
-
-