Package org.apache.wicket.util.file
Class FileCleaner
- java.lang.Object
-
- org.apache.wicket.util.file.FileCleaner
-
- All Implemented Interfaces:
IFileCleaner
public class FileCleaner extends Object implements IFileCleaner
Default implementation ofIFileCleaner
that uses Apache commons-ioFileCleaningTracker
to track and clean the temporary created files.Note: this implementation starts a daemon thread to do the actual work, so it may not be used in some environments like Google AppEngine.
-
-
Constructor Summary
Constructors Constructor Description FileCleaner()
Construct.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
destroy()
Call this method to stop the cleaner and to free all allocated resources by itvoid
track(File file, Object marker)
Track the specified file, using the provided marker, deleting the file when the marker instance is garbage collected.void
track(File file, Object marker, org.apache.commons.io.FileDeleteStrategy deleteStrategy)
Track the specified file, using the provided marker, deleting the file when the marker instance is garbage collected.
-
-
-
Constructor Detail
-
FileCleaner
public FileCleaner()
Construct.
-
-
Method Detail
-
track
public void track(File file, Object marker)
Description copied from interface:IFileCleaner
Track the specified file, using the provided marker, deleting the file when the marker instance is garbage collected.- Specified by:
track
in interfaceIFileCleaner
- Parameters:
file
- the file to be tracked, not nullmarker
- the marker object used to track the file, not null
-
track
public void track(File file, Object marker, org.apache.commons.io.FileDeleteStrategy deleteStrategy)
Description copied from interface:IFileCleaner
Track the specified file, using the provided marker, deleting the file when the marker instance is garbage collected.- Specified by:
track
in interfaceIFileCleaner
- Parameters:
file
- the file to be tracked, not nullmarker
- the marker object used to track the file, not nulldeleteStrategy
- the strategy that actually deletes the file. E.g. to delete a non-empty folder the strategy should delete all children first
-
destroy
public void destroy()
Description copied from interface:IFileCleaner
Call this method to stop the cleaner and to free all allocated resources by it- Specified by:
destroy
in interfaceIFileCleaner
-
-