List of usage examples for java.nio.file Files isRegularFile
public static boolean isRegularFile(Path path, LinkOption... options)
From source file:uk.trainwatch.io.ftp.FTPClient.java
default boolean retrieveIfNeeded(FTPFile remote, Path target, CopyOption... options) throws IOException { if (remote != null && target != null && isPathRetrievable(target, remote)) { try (InputStream is = retrieveFileStream(remote)) { if (is == null) { throw new FileNotFoundException(target.toString()); }/* w ww . j a v a 2 s . com*/ Files.copy(is, target, options); } finally { completePendingCommand(); } } return Files.exists(target, LinkOption.NOFOLLOW_LINKS) && Files.isRegularFile(target, LinkOption.NOFOLLOW_LINKS); }
From source file:org.glite.authz.pep.pip.provider.InInfoFileIssuerDNMatcher.java
/** * Adds all .info files from the grid-security/certificates folder to the * variable infoFilesAll. As last the method returns a list containing * Strings. The Strings contain all *.info files. * /*from ww w . jav a2 s . co m*/ * @return A list of strings. The strings represent *.info file. */ private List<String> findAllInfoFiles() throws IOException { List<String> infoFilesAll = new ArrayList<String>(); DirectoryStream<Path> stream = null; try { stream = Files.newDirectoryStream(Paths.get(acceptedtrustInfoDir), "*.info"); } catch (Exception e) { log.error(e.getMessage()); return infoFilesAll; } try { for (Path entry : stream) { if (Files.isRegularFile(entry, LinkOption.NOFOLLOW_LINKS)) { infoFilesAll.add(entry.getFileName().toString()); } } } catch (Exception e) { log.error(e.getMessage()); } finally { stream.close(); } return infoFilesAll; }