Class DeletingVisitor
java.lang.Object
java.nio.file.SimpleFileVisitor<Path>
org.apache.logging.log4j.core.appender.rolling.action.DeletingVisitor
- All Implemented Interfaces:
- FileVisitor<Path>
FileVisitor that deletes files that are accepted by all PathFilters. Directories are ignored.
- 
Constructor SummaryConstructorsConstructorDescriptionDeletingVisitor(Path basePath, List<? extends PathCondition> pathConditions, boolean testMode) Constructs a new DeletingVisitor.
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidDeletes the specified file.booleanReturnstrueif files are not deleted even when all conditions accept a path,falseotherwise.visitFile(Path file, BasicFileAttributes attrs) visitFileFailed(Path file, IOException ioException) Methods inherited from class java.nio.file.SimpleFileVisitorpostVisitDirectory, preVisitDirectory
- 
Constructor Details- 
DeletingVisitorpublic DeletingVisitor(Path basePath, List<? extends PathCondition> pathConditions, boolean testMode) Constructs a new DeletingVisitor.- Parameters:
- basePath- used to relativize paths
- pathConditions- objects that need to confirm whether a file can be deleted
- testMode- if true, files are not deleted but instead a message is printed to the status logger at INFO level. Users can use this to do a dry run to test if their configuration works as expected.
 
 
- 
- 
Method Details- 
visitFile- Specified by:
- visitFilein interface- FileVisitor<Path>
- Overrides:
- visitFilein class- SimpleFileVisitor<Path>
- Throws:
- IOException
 
- 
visitFileFailed- Specified by:
- visitFileFailedin interface- FileVisitor<Path>
- Overrides:
- visitFileFailedin class- SimpleFileVisitor<Path>
- Throws:
- IOException
 
- 
deleteDeletes the specified file.- Parameters:
- file- the file to delete
- Throws:
- IOException- if a problem occurred deleting the file
 
- 
isTestModepublic boolean isTestMode()Returnstrueif files are not deleted even when all conditions accept a path,falseotherwise.- Returns:
- trueif files are not deleted even when all conditions accept a path,- falseotherwise
 
 
-