本文整理汇总了Java中java.nio.file.FileVisitResult.CONTINUE属性的典型用法代码示例。如果您正苦于以下问题:Java FileVisitResult.CONTINUE属性的具体用法?Java FileVisitResult.CONTINUE怎么用?Java FileVisitResult.CONTINUE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.nio.file.FileVisitResult
的用法示例。
在下文中一共展示了FileVisitResult.CONTINUE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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;
}
示例3: visitFile
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
Path relativePath = basePath.relativize(file);
if (!filesToIgnore.contains(relativePath.toString())) {
savedFiles.add(file);
}
return FileVisitResult.CONTINUE;
}
示例4: postVisitDirectory
@Override
public FileVisitResult postVisitDirectory(Path dir, IOException exc)
throws IOException
{
if (exc != null)
super.postVisitDirectory(dir, exc);
if (dir.getFileName() != null)
indent--;
return FileVisitResult.CONTINUE;
}
示例5: visitFile
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
final String fileName = file.getFileName().toString();
if (fileName.equals(N4JSGlobals.PACKAGE_JSON)) {
cleanJsonFile(file.toFile());
return FileVisitResult.SKIP_SUBTREE;
}
return FileVisitResult.CONTINUE;
}
示例6: postVisitDirectory
@Override
public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
if (exc == null) {
Files.delete(dir);
return FileVisitResult.CONTINUE;
}
throw exc;
}
示例7: postVisitDirectory
@Override
public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
File directory = dir.toAbsolutePath().toFile();
File[] children = directory.listFiles();
if (children == null || children.length == 0) {
boolean deleted = directory.delete();
if (deleted) {
deletedDirectoryCount++;
logger.debug("Deleted directory {}", dir);
}
}
return FileVisitResult.CONTINUE;
}
示例8: visitFile
@Override
public FileVisitResult visitFile(Path file1, BasicFileAttributes attrs) throws IOException{
String relativeFilePath = pathToBeCompared.relativize(file1).toString();
File file2 = new File(pathToCompareTo.toFile(), relativeFilePath);
if (!file2.exists() && isInSource){
if (!deletedFiles.contains(relativeFilePath)){
fail(isInSource() + "file is missing but not in deleted list: " + relativeFilePath);
}
deletedFiles.remove(relativeFilePath);
}
if (!file2.exists() && !isInSource){
if (!newFiles.contains(relativeFilePath)){
fail(isInSource() + "file is missing but not in new list: " + relativeFilePath);
}
newFiles.remove(relativeFilePath);
}
if (file2.exists() && file2.isDirectory()){
fail(isInSource() + "file is a directory: " + relativeFilePath);
}
if (file2.exists() && !Arrays.equals(Files.readAllBytes(file1), Files.readAllBytes(file2.toPath()))){
if (!modifiedFiles.containsKey(relativeFilePath)){
fail(isInSource() + "Source and target files differ, but this file is "
+ "not in list of modified objects: " + relativeFilePath);
}
String hash = modifiedFiles.remove(relativeFilePath);
File file = isInSource ? file2 : file1.toFile();
String partialFile = new String(Files.readAllBytes(file.toPath()), PartialExporterTest.UTF_8);
Assert.assertEquals("Files differ, and partial file has unexpected hash"
+ "\nPartial file:\n" + partialFile,
hash,
PgDiffUtils.md5(partialFile));
}
return FileVisitResult.CONTINUE;
}
示例9: preVisitDirectory
@Override
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
Path relativePath = basePath.relativize(dir);
if (filesToIgnore.contains(relativePath.toString())) {
return FileVisitResult.SKIP_SUBTREE;
} else {
return FileVisitResult.CONTINUE;
}
}
示例10: visitFile
@Override
public FileVisitResult visitFile(Path path, BasicFileAttributes attr) {
File file = path.toFile();
if (GRADLE_PROPERTIES.equals(file.getName())) {
if (pathIgnored(file)) {
log.debug("Ignoring file [{}] since it's on a list of patterns to ignore", file);
return FileVisitResult.CONTINUE;
}
log.info("Will process the file [{}] and update its gradle properties", file);
final String fileContents = asString(path);
final AtomicReference<String> changedString = new AtomicReference<>(fileContents);
Properties props = loadProps(file);
final Map<String, String> substitution = this.properties.getGradle()
.getGradlePropsSubstitution();
props.entrySet().stream().forEach(entry -> {
if (substitution.containsKey(entry.getKey())) {
Object projectName = substitution.get(entry.getKey());
ProjectVersion value = this.projects.forName((String) projectName);
log.info("Replacing [{}->{}] with [{}->{}]", entry.getKey(), entry.getValue(), entry.getKey(), value);
changedString.set(changedString.get().replace(entry.getKey() + "=" + entry.getValue(),
entry.getKey() + "=" + value));
}
});
storeString(path, changedString.get());
assertNoSnapshotsArePresent(path);
}
return FileVisitResult.CONTINUE;
}
示例11: visitFile
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
//System.out.println("visitFile: " + file + " -> " + attrs);
File bFile = file.toAbsolutePath().toFile();
if (!fileSet.contains(bFile)) {
boolean deleted = bFile.delete();
if (deleted) {
deletedFileCount++;
logger.debug("Deleted file {}", file);
}
}
return FileVisitResult.CONTINUE;
}
示例12: visitFileFailed
@Override
public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException
{
return FileVisitResult.CONTINUE;
}
示例13: visitFile
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
Files.delete(file);
return FileVisitResult.CONTINUE;
}
示例14: visitFileFailed
@Override
public FileVisitResult visitFileFailed(Path file, IOException exc) {
return FileVisitResult.CONTINUE;
}
示例15: postVisitDirectory
@Override
public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
return FileVisitResult.CONTINUE;
}