当前位置: 首页>>代码示例>>Java>>正文


Java FileVisitResult.CONTINUE属性代码示例

本文整理汇总了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;
}
 
开发者ID:xtf-cz,项目名称:xtf,代码行数:23,代码来源:SourceCodeUpdater.java

示例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;
}
 
开发者ID:klask-io,项目名称:klask-io,代码行数:13,代码来源:FileSystemVisitorCrawler.java

示例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;
}
 
开发者ID:Azzurite,项目名称:MinecraftServerSync,代码行数:8,代码来源:FilteringSaveFileListVisitor.java

示例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;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:Basic.java

示例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;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:9,代码来源:UpdateShippedCode.java

示例6: postVisitDirectory

@Override
public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
    if (exc == null) {
        Files.delete(dir);
        return FileVisitResult.CONTINUE;
    }
    throw exc;
}
 
开发者ID:SAP,项目名称:cf-mta-deploy-service,代码行数:8,代码来源:FileUtils.java

示例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;
}
 
开发者ID:EHRI,项目名称:rs-aggregator,代码行数:13,代码来源:FileCleaner.java

示例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;
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:37,代码来源:PartialExportTestFileVisitor.java

示例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;
	}
}
 
开发者ID:Azzurite,项目名称:MinecraftServerSync,代码行数:9,代码来源:FilteringSaveFileListVisitor.java

示例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;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-release-tools,代码行数:28,代码来源:GradleUpdater.java

示例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;
}
 
开发者ID:EHRI,项目名称:rs-aggregator,代码行数:13,代码来源:FileCleaner.java

示例12: visitFileFailed

@Override
public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException
{
    return FileVisitResult.CONTINUE;
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:5,代码来源:DirectorySizeCalculator.java

示例13: visitFile

@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
    Files.delete(file);
    return FileVisitResult.CONTINUE;
}
 
开发者ID:SAP,项目名称:cf-mta-deploy-service,代码行数:5,代码来源:FileUtils.java

示例14: visitFileFailed

@Override
public FileVisitResult visitFileFailed(Path file, IOException exc) {
    return FileVisitResult.CONTINUE;
}
 
开发者ID:virallalakia,项目名称:ViralFileCrypt,代码行数:4,代码来源:ViralFileCrypt.java

示例15: postVisitDirectory

@Override
public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
	return FileVisitResult.CONTINUE;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:4,代码来源:UpdateShippedCode.java


注:本文中的java.nio.file.FileVisitResult.CONTINUE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。