Package org.marketcetera.util.file
Class Deleter
- java.lang.Object
-
- org.marketcetera.util.file.Deleter
-
public class Deleter extends Object
Deletes a file or directory recursively. It does not follow symbolic links in the process.- Since:
- 0.5.0
- Version:
- $Id: Deleter.java 17784 2018-11-19 21:08:09Z colin $
- Author:
- tlerios@marketcetera.com
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classDeleter.RecursiveDeleterASmartLinksDirectoryWalkerthat does not follow symbolic links, and deletes all files it traverses.
-
Constructor Summary
Constructors Constructor Description Deleter()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidapply(File root)Deletes the file tree rooted at the given root.static voidapply(String name)Deletes the file tree rooted at the file with the given name.private static voiddeleteWrap(File file)Deletes the given file.
-
-
-
Method Detail
-
deleteWrap
private static void deleteWrap(File file) throws IOException
Deletes the given file. If the file represents a directory, it must be empty.- Parameters:
file- The file.- Throws:
IOException- Thrown if an I/O error occurs. It has no message and wraps anI18NException.
-
apply
public static void apply(File root) throws I18NException
Deletes the file tree rooted at the given root. It does not follow symbolic links in the process. The root may be nonexistent (or no-op).- Parameters:
root- The root.- Throws:
I18NException- Thrown if an I/O error occurs.
-
apply
public static void apply(String name) throws I18NException
Deletes the file tree rooted at the file with the given name. It does not follow symbolic links in the process. The root may be nonexistent (no-op).- Parameters:
name- The file name.- Throws:
I18NException- Thrown if an I/O error occurs.
-
-