Example usage for java.nio.file FileVisitResult TERMINATE

List of usage examples for java.nio.file FileVisitResult TERMINATE

Introduction

In this page you can find the example usage for java.nio.file FileVisitResult TERMINATE.

Prototype

FileVisitResult TERMINATE

To view the source code for java.nio.file FileVisitResult TERMINATE.

Click Source Link

Document

Terminate.

Usage

From source file:se.trixon.toolbox.checksum.FileVisitor.java

@Override
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
    if (Thread.interrupted()) {
        mInterrupted = true;//from  www. j  av a 2s  . c om
        return FileVisitResult.TERMINATE;
    }

    Toolbox.setStatusText(dir.toFile().getAbsolutePath(), StatusDisplayer.IMPORTANCE_ERROR_HIGHLIGHT);

    String[] filePaths = dir.toFile().list();

    if (filePaths != null && filePaths.length > 0) {
        for (String fileName : filePaths) {
            File file = new File(dir.toFile(), fileName);
            if (file.isFile()) {
                mRelativePaths.add(getRelativePath(file, mBaseDir));
            }
        }
    }

    return FileVisitResult.CONTINUE;
}