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

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

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

DirectoryStream.forEach介绍

暂无

代码示例

代码示例来源: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: kiegroup/drools-wb

private void updateGraphElementPaths(final Path source,
                   final Path destination) {
  try (final DirectoryStream<org.uberfire.java.nio.file.Path> directoryStream =
         ioService.newDirectoryStream(getParentFolder(source),
                       new FileExtensionFilter(dtableGraphType.getSuffix()))) {
    directoryStream.forEach((path) -> updateGraphElementPath(source,
                                 destination,
                                 Paths.convert(path)));
  }
}

代码示例来源:origin: kiegroup/drools-wb

@Override
public void postProcess(final Path source,
            final Path destination) {
  try (DirectoryStream<org.uberfire.java.nio.file.Path> directoryStream =
         ioService.newDirectoryStream(getParentFolder(source),
                       new FileExtensionFilter(dtableGraphType.getSuffix()))) {
    directoryStream.forEach((path) -> updateGraphElementPath(source,
                                 destination,
                                 Paths.convert(path)));
  }
}

代码示例来源:origin: kiegroup/drools-wb

@Override
public void postProcess(final Path path) {
  try (final DirectoryStream<org.uberfire.java.nio.file.Path> directoryStream =
         ioService.newDirectoryStream(getParentFolder(path),
                       new FileExtensionFilter(dtableGraphType.getSuffix()))) {
    directoryStream.forEach((p) -> updateGraphReferences(path,
                               Paths.convert(p)));
  }
}

相关文章