org.uberfire.java.nio.file.DirectoryStream.close()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(4.4k)|赞(0)|评价(0)|浏览(96)

本文整理了Java中org.uberfire.java.nio.file.DirectoryStream.close()方法的一些代码示例,展示了DirectoryStream.close()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DirectoryStream.close()方法的具体详情如下:
包路径:org.uberfire.java.nio.file.DirectoryStream
类名称:DirectoryStream
方法名:close

DirectoryStream.close介绍

暂无

代码示例

代码示例来源:origin: org.uberfire/uberfire-project-backend

private void lookForModulesFromFolders(final Path folderPath) {
  final DirectoryStream<Path> nioRepositoryPaths = ioService.newDirectoryStream(folderPath);
  try {
    for (final Path nioRepositoryPath : nioRepositoryPaths) {
      if (Files.isDirectory(nioRepositoryPath)) {
        findModule(nioRepositoryPath,
              false);
      }
    }
  } finally {
    nioRepositoryPaths.close();
  }
}

代码示例来源:origin: kiegroup/appformer

private void lookForModulesFromFolders(final Path folderPath) {
  final DirectoryStream<Path> nioRepositoryPaths = ioService.newDirectoryStream(folderPath);
  try {
    for (final Path nioRepositoryPath : nioRepositoryPaths) {
      if (Files.isDirectory(nioRepositoryPath)) {
        findModule(nioRepositoryPath,
              false);
      }
    }
  } finally {
    nioRepositoryPaths.close();
  }
}

代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-datasource-mgmt-backend

private Collection<DriverDefInfo> resolveDrivers(final Path path) {
  final org.uberfire.java.nio.file.Path nioPath = Paths.convert(path);
  final List<DriverDefInfo> result = new ArrayList<>();
  try {
    final DirectoryStream<org.uberfire.java.nio.file.Path> stream = ioService.newDirectoryStream(nioPath,
                                                   entry -> Files.isRegularFile(entry) &&
                                                       !entry.getFileName().toString().startsWith(".") &&
                                                       entry.getFileName().toString().endsWith(DRIVER_FILE_TYPE));
    stream.forEach(file -> {
      result.add(createDriverInfo(file));
    });
    stream.close();
    return result;
  } catch (Exception e) {
    logger.error("It was not possible read drivers info from: " + path,
           e);
    throw ExceptionUtilities.handleException(e);
  }
}

代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-datasource-mgmt-backend

private Collection<DataSourceDefInfo> resolveDataSources(final Path path) {
  final org.uberfire.java.nio.file.Path nioPath = Paths.convert(path);
  final List<DataSourceDefInfo> result = new ArrayList<>();
  try {
    final DirectoryStream<org.uberfire.java.nio.file.Path> stream = ioService.newDirectoryStream(nioPath,
                                                   entry -> Files.isRegularFile(entry) &&
                                                       !entry.getFileName().toString().startsWith(".") &&
                                                       entry.getFileName().toString().endsWith(DS_FILE_TYPE));
    stream.forEach(file -> {
      result.add(createDataSourceDefInfo(file));
    });
    stream.close();
    return result;
  } catch (Exception e) {
    logger.error("It was not possible read data sources info from: " + path,
           e);
    throw ExceptionUtilities.handleException(e);
  }
}

代码示例来源:origin: org.guvnor/guvnor-project-backend

public Set<Project> getProjects(final Repository repository,
                String branch,
                boolean secure) {
  final Set<Project> authorizedProjects = new HashSet<Project>();
  if (repository == null) {
    return authorizedProjects;
  }
  final Path repositoryRoot = repository.getBranchRoot(branch);
  final DirectoryStream<org.uberfire.java.nio.file.Path> nioRepositoryPaths = ioService.newDirectoryStream(Paths.convert(repositoryRoot));
  try {
    for (org.uberfire.java.nio.file.Path nioRepositoryPath : nioRepositoryPaths) {
      if (Files.isDirectory(nioRepositoryPath)) {
        final org.uberfire.backend.vfs.Path projectPath = Paths.convert(nioRepositoryPath);
        final Project project = resourceResolver.resolveProject(projectPath);
        if (project != null) {
          if (!secure || authorizationManager.authorize(project,
                                 sessionInfo.getIdentity())) {
            POM projectPom = pomService.load(project.getPomXMLPath());
            project.setPom(projectPom);
            authorizedProjects.add(project);
          }
        }
      }
    }
  } finally {
    nioRepositoryPaths.close();
  }
  return authorizedProjects;
}

代码示例来源:origin: org.uberfire/uberfire-nio2-fs

.isInstanceOf(UnsupportedOperationException.class);
stream2.close();
assertThatThrownBy(() -> stream2.close())
    .isInstanceOf(org.uberfire.java.nio.IOException.class)
    .hasMessage("This stream is closed.");
                    path2);
stream3.close();

代码示例来源:origin: kiegroup/appformer

.isInstanceOf(UnsupportedOperationException.class);
stream2.close();
assertThatThrownBy(() -> stream2.close())
    .isInstanceOf(org.uberfire.java.nio.IOException.class)
    .hasMessage("This stream is closed.");
                    path2);
stream3.close();

代码示例来源:origin: org.uberfire/vfs-api

stream.close();
} catch (IOException ex) {
  if (postException == null) {

代码示例来源:origin: org.uberfire/uberfire-nio2-api

stream.close();
} catch (IOException ex) {
  if (postException == null) {

代码示例来源:origin: kiegroup/appformer

stream.close();
} catch (IOException ex) {
  if (postException == null) {

相关文章