Package org.cryptomator.cryptofs.common
Class DeletingFileVisitor
- java.lang.Object
-
- java.nio.file.SimpleFileVisitor<Path>
-
- org.cryptomator.cryptofs.common.DeletingFileVisitor
-
- All Implemented Interfaces:
FileVisitor<Path>
public class DeletingFileVisitor extends SimpleFileVisitor<Path>
-
-
Field Summary
Fields Modifier and Type Field Description static DeletingFileVisitorINSTANCE
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidforceDeleteIfExists(Path path)Tries to remove any write protection of the given file and tries to delete it afterwards.FileVisitResultpostVisitDirectory(Path dir, IOException exc)FileVisitResultvisitFile(Path file, BasicFileAttributes attrs)FileVisitResultvisitFileFailed(Path file, IOException exc)-
Methods inherited from class java.nio.file.SimpleFileVisitor
preVisitDirectory
-
-
-
-
Field Detail
-
INSTANCE
public static final DeletingFileVisitor INSTANCE
-
-
Method Detail
-
visitFileFailed
public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException
- Specified by:
visitFileFailedin interfaceFileVisitor<Path>- Overrides:
visitFileFailedin classSimpleFileVisitor<Path>- Throws:
IOException
-
visitFile
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException
- Specified by:
visitFilein interfaceFileVisitor<Path>- Overrides:
visitFilein classSimpleFileVisitor<Path>- Throws:
IOException
-
postVisitDirectory
public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException
- Specified by:
postVisitDirectoryin interfaceFileVisitor<Path>- Overrides:
postVisitDirectoryin classSimpleFileVisitor<Path>- Throws:
IOException
-
forceDeleteIfExists
public static void forceDeleteIfExists(Path path) throws IOException
Tries to remove any write protection of the given file and tries to delete it afterwards.- Parameters:
path- Path ot a single file or directory. Will not be deleted recursively.- Throws:
IOException- exception thrown by delete. Any exceptions during removal of write protection will be ignored.
-
-