org.apache.commons.io

Class FileCleaner.Tracker

Enclosing Class:
FileCleaner

private static class FileCleaner.Tracker
extends PhantomReference

Inner class which acts as the reference for a file pending deletion.

Field Summary

private String
path
The full path to the file being tracked.

Constructor Summary

Tracker(File file, Object marker, ReferenceQueue q)
Constructs an instance of this class from the supplied parameters.
Tracker(String path, Object marker, ReferenceQueue q)
Constructs an instance of this class from the supplied parameters.

Method Summary

boolean
delete()
Deletes the file associated with this tracker instance.

Field Details

path

private String path
The full path to the file being tracked.

Constructor Details

Tracker

public Tracker(File file,
               Object marker,
               ReferenceQueue q)
Constructs an instance of this class from the supplied parameters.
Parameters:
file - The file to be tracked.
marker - The marker object used to track the file.
q - The queue on to which the tracker will be pushed.

Tracker

public Tracker(String path,
               Object marker,
               ReferenceQueue q)
Constructs an instance of this class from the supplied parameters.
Parameters:
path - The full path to the file to be tracked.
marker - The marker object used to track the file.
q - The queue on to which the tracker will be pushed.

Method Details

delete

public boolean delete()
Deletes the file associated with this tracker instance.
Returns:
true if the file was deleted successfully; false otherwise.