@Override public boolean accept(final Path path) { if (!Files.isDirectory(path)) { return false; } if (next != null) { return next.accept(path); } return true; }
@Override public boolean isDirectory(final String uri) { return Files.isDirectory(ioService.get(URI.create(uri))); }
@Override public boolean accept(final Path path) { if (!Files.isDirectory(path)) { return false; } if (next != null) { return next.accept(path); } return true; }
public Collection<Path> resolveResources(final org.uberfire.java.nio.file.Path resource, final org.uberfire.java.nio.file.Path global, final org.uberfire.java.nio.file.Path resources, final Function<org.uberfire.java.nio.file.Path, org.uberfire.java.nio.file.Path> mapper) { final org.uberfire.java.nio.file.Path resourcePath = Files.isDirectory(resource) ? resource : resource.getParent(); return Stream.of(resourcePath, global, resources) .map(mapper) .filter(ioService::exists) .map(Paths::convert) .collect(Collectors.toList()); }
private boolean isFromType(Path file, Collection<String> fileTypes) { if (Files.isDirectory( file )) return false; for (String type : fileTypes) { if (file.getFileName().toString().endsWith( type ) && !file.getFileName().toString().startsWith( "." )) return true; } return false; }
private DirectoryStream<Path> getDirectoryStreamForFilesWithParticularExtension(final Path dir, final String extension) { return ioService.newDirectoryStream(dir, entry -> { if (!Files.isDirectory(entry) && !entry.getFileName().toString().startsWith(".") && entry.getFileName().toString().endsWith(extension)) { return true; } return false; }); }
public static DirectoryStream<Path> newDirectoryStream(final Path dir, final String glob) throws IllegalArgumentException, UnsupportedOperationException, PatternSyntaxException, NotDirectoryException, IOException, SecurityException { checkNotNull("dir", dir); checkNotEmpty("glob", glob); if (!isDirectory(dir)) { throw new NotDirectoryException(dir.toString()); } throw new UnsupportedOperationException("feature not available"); }
org.uberfire.java.nio.file.Path getParentFolder(final Path path) { org.uberfire.java.nio.file.Path nioFolderPath = Paths.convert(path); return Files.isDirectory(nioFolderPath) ? nioFolderPath : nioFolderPath.getParent(); }
private void addPath(DirectoryStream<Path> directoryStream) throws IOException { for (Path subPath : directoryStream) { if (Files.isDirectory(subPath)) { addPath(Files.newDirectoryStream(subPath)); } else { addFile(subPath); } } }
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(); } }
private void addPath(DirectoryStream<Path> directoryStream) throws IOException { for (Path subPath : directoryStream) { if (Files.isDirectory(subPath)) { addPath(Files.newDirectoryStream(subPath)); } else { addFile(subPath); } } }
@Test public void isDirectoryNull() { assertThatThrownBy(() -> Files.isDirectory(null)) .isInstanceOf(IllegalArgumentException.class) .hasMessage("Parameter named 'path' should be not null!"); }
@Override public boolean accept(final org.uberfire.java.nio.file.Path entry) throws org.uberfire.java.nio.IOException { if (Paths.convert(entry).toURI().endsWith(PathFactory.LOCK_FILE_EXTENSION)) { accu.add(Paths.convert(entry)); } else if (Files.isDirectory(entry)) { retrieveLocks(ioService.get(entry.toUri()), accu); } return true; } };
private void zip() throws IOException { if (Files.isDirectory(originalPath)) { addPath(Files.newDirectoryStream(originalPath)); } else { addFile(originalPath); } zipWriter.close(); }
private void zip() throws IOException { if (Files.isDirectory(originalPath)) { addPath(Files.newDirectoryStream(originalPath)); } else { addFile(originalPath); } zipWriter.close(); }
@Test public void isDirectory() { final Path path = Files.createTempFile("foo", "bar"); assertThat(Files.isDirectory(path)).isFalse(); assertThat(Files.isDirectory(newTempDir())).isTrue(); assertThat(Files.isDirectory(Paths.get("/some/file"))).isFalse(); }
public Path buildTargetPath(Path originalPath, String targetFileName) { final org.uberfire.java.nio.file.Path _originalPath = Paths.convert(originalPath); String extension = ""; if (!Files.isDirectory(_originalPath)) { extension = getExtension(originalPath.getFileName()); } return Paths.convert(_originalPath.resolveSibling(targetFileName + extension)); }
public Path buildTargetPath(Path originalPath, String targetFileName) { final org.uberfire.java.nio.file.Path _originalPath = Paths.convert(originalPath); String extension = ""; if (!Files.isDirectory(_originalPath)) { extension = getExtension(originalPath.getFileName()); } return Paths.convert(_originalPath.resolveSibling(targetFileName + extension)); }
public Path buildTargetPath(Path originalPath, Path targetParentDirectory, String targetFileName) { final org.uberfire.java.nio.file.Path _originalPath = Paths.convert(originalPath); final org.uberfire.java.nio.file.Path _targetParentDirectory = Paths.convert(targetParentDirectory); String extension = ""; if (!Files.isDirectory(_originalPath)) { extension = getExtension(originalPath.getFileName()); } return Paths.convert(_targetParentDirectory.resolve(targetFileName + extension)); }
public Path buildTargetPath(Path originalPath, Path targetParentDirectory, String targetFileName) { final org.uberfire.java.nio.file.Path _originalPath = Paths.convert(originalPath); final org.uberfire.java.nio.file.Path _targetParentDirectory = Paths.convert(targetParentDirectory); String extension = ""; if (!Files.isDirectory(_originalPath)) { extension = getExtension(originalPath.getFileName()); } return Paths.convert(_targetParentDirectory.resolve(targetFileName + extension)); }