Class DeleteFileVisitor

  • All Implemented Interfaces:
    java.nio.file.FileVisitor<java.nio.file.Path>

    public class DeleteFileVisitor
    extends java.nio.file.SimpleFileVisitor<java.nio.file.Path>
    Represents a FileVisitor which will recursively delete a directory with all its contents.

    Example usage: Files.walkFileTree(dir, DeleteFileVisitor.INSTANCE);

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected DeleteFileVisitor()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.nio.file.FileVisitResult postVisitDirectory​(java.nio.file.Path dir, java.io.IOException exc)  
      java.nio.file.FileVisitResult visitFile​(java.nio.file.Path file, java.nio.file.attribute.BasicFileAttributes attrs)  
      • Methods inherited from class java.nio.file.SimpleFileVisitor

        preVisitDirectory, visitFileFailed
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DeleteFileVisitor

        protected DeleteFileVisitor()
    • Method Detail

      • visitFile

        public java.nio.file.FileVisitResult visitFile​(java.nio.file.Path file,
                                                       java.nio.file.attribute.BasicFileAttributes attrs)
                                                throws java.io.IOException
        Specified by:
        visitFile in interface java.nio.file.FileVisitor<java.nio.file.Path>
        Overrides:
        visitFile in class java.nio.file.SimpleFileVisitor<java.nio.file.Path>
        Throws:
        java.io.IOException
      • postVisitDirectory

        public java.nio.file.FileVisitResult postVisitDirectory​(java.nio.file.Path dir,
                                                                java.io.IOException exc)
                                                         throws java.io.IOException
        Specified by:
        postVisitDirectory in interface java.nio.file.FileVisitor<java.nio.file.Path>
        Overrides:
        postVisitDirectory in class java.nio.file.SimpleFileVisitor<java.nio.file.Path>
        Throws:
        java.io.IOException