本文整理汇总了Java中java.nio.file.FileVisitResult.TERMINATE属性的典型用法代码示例。如果您正苦于以下问题:Java FileVisitResult.TERMINATE属性的具体用法?Java FileVisitResult.TERMINATE怎么用?Java FileVisitResult.TERMINATE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.nio.file.FileVisitResult
的用法示例。
在下文中一共展示了FileVisitResult.TERMINATE属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: preVisitDirectory
@Override
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attr) {
if (dir.getFileName().toString().equals(".git")) {
return FileVisitResult.SKIP_SUBTREE;
}
if(onDiff == OnDiff.COPY) {
Path relative = expected.relativize(dir);
if (other.resolve(relative).toFile().exists()) {
log.debug("Other has dir: {}", relative);
} else {
diffPresent = true;
try {
log.info("GitRepo does not contain dir: {}, adding", relative);
Files.copy(dir, other.resolve(relative));
} catch (IOException e) {
log.error("IO happend, new build will be created", e.getMessage());
error = true;
return FileVisitResult.TERMINATE;
}
}
}
return FileVisitResult.CONTINUE;
}
示例2: postVisitDirectory
@Override
public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
if(onDiff == OnDiff.DELETE) {
Path relative = expected.relativize(dir);
if (other.resolve(relative).toFile().exists()) {
log.debug("Other has dir: {}", relative);
} else {
diffPresent = true;
try {
log.info("GitRepo contains dir that is no longer present locally: {}, deleting", relative);
Files.delete(dir);
} catch (IOException e) {
log.error("IO happend, new build will be created", e.getMessage());
error = true;
return FileVisitResult.TERMINATE;
}
}
}
return FileVisitResult.CONTINUE;
}
示例3: preVisitDirectory
@Override
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
log.trace("preVisit {}",dir);
//if(Thread.currentThread().isInterrupted()){
if(this.abortAsked){
return FileVisitResult.TERMINATE;
}
if(this.crawler.isDirectoryInExclusion(dir)){
log.trace("exclude directory {}",dir);
return FileVisitResult.SKIP_SUBTREE;//like SKIP_SUBTREE and no call to postVisitDirectory
}
return FileVisitResult.CONTINUE;
}
示例4: visitFile
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
if (file.toString().endsWith(".class")) {
className = getClassName(file.toAbsolutePath().toString());
return FileVisitResult.TERMINATE;
}
return FileVisitResult.CONTINUE;
}
示例5: visitFileFailed
@Override
public FileVisitResult visitFileFailed(Path file, IOException ioe)
throws IOException {
this.exception = ioe;
return FileVisitResult.TERMINATE;
}