Java Code Examples for java.nio.file.FileVisitResult#CONTINUE
The following examples show how to use
java.nio.file.FileVisitResult#CONTINUE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FakeProjectFilesystemTest.java From buck with Apache License 2.0 | 6 votes |
@Test public void testWalkRelativeFileTreeWhenPathIsAFile() throws IOException { FakeProjectFilesystem filesystem = new FakeProjectFilesystem(); filesystem.touch(Paths.get("A.txt")); List<Path> filesVisited = new ArrayList<>(); FileVisitor<Path> fileVisitor = new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path path, BasicFileAttributes attrs) { filesVisited.add(path); return FileVisitResult.CONTINUE; } }; filesystem.walkRelativeFileTree(Paths.get("A.txt"), fileVisitor); // Despite the awkward name, "contains" implies an exact match. assertThat(filesVisited, contains(Paths.get("A.txt"))); }
Example 2
Source File: DefaultProjectFilesystem.java From buck with Apache License 2.0 | 6 votes |
private FileVisitResult visitPath(Path p) throws IOException { BasicFileAttributes attrs; try { attrs = getAttributes(p); ensureNoLoops(p, attrs); } catch (IOException ioe) { return visitor.visitFileFailed(p, ioe); } if (attrs.isDirectory()) { FileVisitResult result = visitor.preVisitDirectory(p, attrs); if (result == FileVisitResult.CONTINUE) { state.add(new DirWalkState(p, attrs, false)); } return result; } else { return visitor.visitFile(p, attrs); } }
Example 3
Source File: SafeFiles.java From util with Apache License 2.0 | 5 votes |
@Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { if (attrs.isRegularFile()) { // no symlinks, pipes, or device nodes please fsync(file); fileCount++; } return FileVisitResult.CONTINUE; }
Example 4
Source File: FileSystem.java From n4js with Eclipse Public License 1.0 | 5 votes |
@Override public FileVisitResult visitFile(final Path file, final BasicFileAttributes attrs) throws IOException { if (file.getFileName().endsWith("dummy")) return FileVisitResult.CONTINUE; Path tgtPath = targetPath.resolve(sourcePath.relativize(file)); if (tgtPath.toFile().exists()) return FileVisitResult.CONTINUE; Files.copy(file, tgtPath); return FileVisitResult.CONTINUE; }
Example 5
Source File: CheckSrcFolderRootFilesWithNoPackage.java From goclipse with Eclipse Public License 1.0 | 5 votes |
@Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { if(file.getFileName().toString().endsWith(".go")) { containsGoSources = true; return FileVisitResult.TERMINATE; } return FileVisitResult.CONTINUE; }
Example 6
Source File: LocalCopyVisitor.java From TerasologyLauncher with Apache License 2.0 | 5 votes |
@Override public FileVisitResult preVisitDirectory(final Path dir, final BasicFileAttributes attrs) throws IOException { final Path dirToCreate = targetDirectory.resolve(sourceDirectory.relativize(dir)); if (Files.notExists(dirToCreate)) { Files.createDirectories(dirToCreate); } return FileVisitResult.CONTINUE; }
Example 7
Source File: BaseMojo.java From jax-maven-plugin with Apache License 2.0 | 5 votes |
@Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs){ if (file.toString().toLowerCase().endsWith(".java")) { this.javaFiles.add(file.toString()); } return FileVisitResult.CONTINUE; }
Example 8
Source File: ThumbnailManager.java From fess with Apache License 2.0 | 5 votes |
@Override public FileVisitResult postVisitDirectory(final Path dir, final IOException e) throws IOException { if (e != null) { logger.warn("I/O exception on " + dir, e); } deleteEmptyDirectory(dir); return FileVisitResult.CONTINUE; }
Example 9
Source File: RamlDirCopier.java From raml-module-builder with Apache License 2.0 | 5 votes |
@Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { Path sourcePath = baseSourceDir.relativize(file); Path targetPath = baseTargetDir.resolve(sourcePath); if (sourcePath.toString().matches(".*(\\.json|\\.schema)$")) { String json = schemaDereferencer.dereferencedSchema(file, targetPath).encodePrettily(); try (PrintWriter printWriter = new PrintWriter(targetPath.toFile())) { printWriter.println(json); } } else { Files.copy(file, targetPath, StandardCopyOption.REPLACE_EXISTING); } return FileVisitResult.CONTINUE; }
Example 10
Source File: ProjectCommandExecutor.java From spring-cloud-release-tools with Apache License 2.0 | 5 votes |
@Override public FileVisitResult visitFile(Path path, BasicFileAttributes attr) { File file = path.toFile(); if (file.getName().endsWith(HTML_EXTENSION) && asString(file).contains("Unresolved")) { throw new IllegalStateException( "File [" + file + "] contains a tag that wasn't resolved properly"); } return FileVisitResult.CONTINUE; }
Example 11
Source File: Directories.java From stratio-cassandra with Apache License 2.0 | 5 votes |
@Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { if (isAcceptable(file)) { size.addAndGet(attrs.size()); visited.add(file.toFile().getName()); } return FileVisitResult.CONTINUE; }
Example 12
Source File: BattleLogs.java From logbook-kai with MIT License | 5 votes |
@Override public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { // 空フォルダチェック try (DirectoryStream<Path> ds = Files.newDirectoryStream(dir)) { if (ds.iterator().hasNext()) { return FileVisitResult.CONTINUE; } } // 空フォルダなら削除 Files.deleteIfExists(dir); return FileVisitResult.CONTINUE; }
Example 13
Source File: FileUtil.java From vjtools with Apache License 2.0 | 4 votes |
@Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { Files.delete(file); return FileVisitResult.CONTINUE; }
Example 14
Source File: CleanDirectoryFileVisitor.java From herddb with Apache License 2.0 | 4 votes |
@Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { Files.delete(file); return FileVisitResult.CONTINUE; }
Example 15
Source File: CleanDirectoryFileVisitor.java From herddb with Apache License 2.0 | 4 votes |
@Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { ++level; return FileVisitResult.CONTINUE; }
Example 16
Source File: DiskJobFileServiceImpl.java From genie with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ @Override public FileVisitResult preVisitDirectory(final Path dir, final BasicFileAttributes attrs) throws IOException { return FileVisitResult.CONTINUE; }
Example 17
Source File: AarGeneratorAction.java From bazel with Apache License 2.0 | 4 votes |
@Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { files.add(file); return FileVisitResult.CONTINUE; }
Example 18
Source File: AndroidResourceOutputs.java From bazel with Apache License 2.0 | 4 votes |
@Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { paths.add(file); return FileVisitResult.CONTINUE; }
Example 19
Source File: DiskJobFileServiceImpl.java From genie with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ @Override public FileVisitResult postVisitDirectory(final Path dir, final IOException exc) throws IOException { return FileVisitResult.CONTINUE; }
Example 20
Source File: ModpackDetectorVisitor.java From SmartModInserter with GNU Lesser General Public License v3.0 | 4 votes |
@Override public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException { return FileVisitResult.CONTINUE; }