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

x33g5p2x  于2022-01-19 转载在 其他  
字(8.8k)|赞(0)|评价(0)|浏览(192)

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

Files.isRegularFile介绍

暂无

代码示例

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

@Override
public boolean accept(final Path path) {
  if (!Files.isRegularFile(path)) {
    return false;
  }
  if (next != null) {
    return next.accept(path);
  }
  return true;
}

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

@Override
public boolean accept(final Path path) {
  if (!Files.isRegularFile(path)) {
    return false;
  }
  if (next != null) {
    return next.accept(path);
  }
  return true;
}

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

@Override
public boolean isRegularFile(final String uri) {
  return Files.isRegularFile(ioService.get(URI.create(uri)));
}

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

@Override
public boolean isRegularFile(final Path path) {
  return Files.isRegularFile(Paths.convert(path));
}

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

@Override
  public boolean accept(final org.uberfire.java.nio.file.Path path) {
    boolean accept = super.accept(path);
    if (accept) {
      return false;
    }
    if (!Files.isRegularFile(path)) {
      return false;
    }
    final String uri = path.toUri().toString();
    if (uri.substring(uri.length() - extension.length()).equals(extension)) {
      return true;
    }
    return false;
  }
}

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

@Override
  public boolean accept(final org.uberfire.java.nio.file.Path path) {
    boolean accept = super.accept(path);
    if (accept) {
      return false;
    }
    if (!Files.isRegularFile(path)) {
      return false;
    }
    final String uri = path.toUri().toString();
    if (uri.substring(uri.length() - extension.length()).equals(extension)) {
      return true;
    }
    return false;
  }
}

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

@Override
  public boolean accept(final org.uberfire.java.nio.file.Path path) {
    //Check with super class first
    boolean accept = super.accept(path);
    if (accept) {
      return false;
    }

    //Only match files
    if (!Files.isRegularFile(path)) {
      return false;
    }

    //Assume the Path does not match by default
    accept = false;
    final String uri = path.toUri().toString();
    for (String extension : extensions) {
      if (uri.substring(uri.length() - extension.length()).equals(extension)) {
        accept = true;
        break;
      }
    }
    return accept;
  }
}

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

@Override
  public boolean accept(final org.uberfire.java.nio.file.Path path) {
    //Check with super class first
    boolean accept = super.accept(path);
    if (accept) {
      return false;
    }

    //Only match files
    if (!Files.isRegularFile(path)) {
      return false;
    }

    //Assume the Path does not match by default
    accept = false;
    final String uri = path.toUri().toString();
    for (String extension : extensions) {
      if (uri.substring(uri.length() - extension.length()).equals(extension)) {
        accept = true;
        break;
      }
    }
    return accept;
  }
}

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

public static String probeContentType(final Path path)
    throws UnsupportedOperationException, IOException, SecurityException {
  checkNotNull("path",
         path);
  if (notExists(path)) {
    throw new NoSuchFileException(path.toString());
  }
  if (!isRegularFile(path)) {
    throw new NoSuchFileException(path.toString());
  }
  throw new UnsupportedOperationException("feature not available");
}

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

public static String probeContentType(final Path path)
    throws UnsupportedOperationException, IOException, SecurityException {
  checkNotNull("path", path);
  if (notExists(path)) {
    throw new NoSuchFileException(path.toString());
  }
  if (!isRegularFile(path)) {
    throw new NoSuchFileException(path.toString());
  }
  throw new UnsupportedOperationException("feature not available");
}

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

public static String probeContentType(final Path path)
    throws UnsupportedOperationException, IOException, SecurityException {
  checkNotNull("path",
         path);
  if (notExists(path)) {
    throw new NoSuchFileException(path.toString());
  }
  if (!isRegularFile(path)) {
    throw new NoSuchFileException(path.toString());
  }
  throw new UnsupportedOperationException("feature not available");
}

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

@Test
public void isRegularFileNull() {
  assertThatThrownBy(() -> Files.isRegularFile(null))
      .isInstanceOf(IllegalArgumentException.class)
      .hasMessage("Parameter named 'path' should be not null!");
}

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

@Override
public String getTemplateContent(String url) {
  String pluginTemplateContent = getRuntimePluginTemplateContent(url);
  if (isAJarPluginTemplate(pluginTemplateContent)) {
    return pluginTemplateContent;
  }
  String realPath = PluginUtils.getRealPath("plugins");
  if (realPath == null) {
    LOGGER.info("Not fetching template content for " + url + " because getRealPath() is"
              + " returning null. (This app is probably deployed in an unexploded .war)");
    return "";
  }
  final Path template;
  if (url.startsWith("/")) {
    template = Paths.get(URI.create("file://" + realPath + url));
  } else {
    template = Paths.get(URI.create("file://" + realPath + "/" + url));
  }
  if (Files.isRegularFile(template)) {
    return new String(Files.readAllBytes(template));
  }
  return "";
}

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

@Test
public void isRegularFile() {
  final Path path = Files.createTempFile("foo", "bar");
  assertThat(Files.isRegularFile(path)).isTrue();
  assertThat(Files.isRegularFile(newTempDir())).isFalse();
  assertThat(Files.isRegularFile(Paths.get("/some/file"))).isFalse();
}

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

public FolderItem toFolderItem(final org.uberfire.java.nio.file.Path path) {
  if (Files.isRegularFile(path)) {
    final org.uberfire.backend.vfs.Path p = Paths.convert(path);
    return new FolderItem(p,
               p.getFileName(),
               FolderItemType.FILE,
               false,
               Paths.readLockedBy(p),
               Collections.<String>emptyList(),
               getRestrictedOperations(p));
  } else if (Files.isDirectory(path)) {
    final org.uberfire.backend.vfs.Path p = Paths.convert(path);
    return new FolderItem(p,
               p.getFileName(),
               FolderItemType.FOLDER);
  }
  return null;
}

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

private IncrementalBuildResults addResource(final Path resource,
                      final InputStream inputStream) {
  checkNotNull("resource",
         resource);
  //Only files can be processed
  if (!Files.isRegularFile(resource)) {
    return new IncrementalBuildResults(projectGAV);
  }
  checkAFullBuildHasBeenPerformed();
  //Resource Type might require "external" validation (i.e. it's not covered by Kie)
  final IncrementalBuildResults results = new IncrementalBuildResults(projectGAV);
  final BuildValidationHelper validator = getBuildValidationHelper(resource);
  if (validator != null) {
    final List<ValidationMessage> addedValidationMessages = validator.validate(Paths.convert(resource));
    results.addAllAddedMessages(convertValidationMessages(addedValidationMessages));
    results.addAllRemovedMessages(convertValidationMessages(nonKieResourceValidationHelperMessages.remove(resource)));
    nonKieResourceValidationHelpers.put(resource,
                      validator);
    nonKieResourceValidationHelperMessages.put(resource,
                          addedValidationMessages);
  }
  synchronized (kieFileSystem) {
    addNewResource(resource,
            inputStream);
    buildIncrementally(results,
              destinationPath(resource));
  }
  return results;
}

代码示例来源:origin: org.drools/drools-wb-test-scenario-editor-backend

for (final org.uberfire.java.nio.file.Path p : directoryStream) {
  if (filter.accept(p) && fileExtensionFilter.accept(p)) {
    if (Files.isRegularFile(p)) {
      items.add(Paths.convert(p));
    } else if (Files.isDirectory(p)) {

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

if (Files.isRegularFile(path)) {
  path = path.getParent();

相关文章