List of usage examples for java.nio.file Path getFileName
Path getFileName();
From source file:DeleteDirectory.java
@Override public FileVisitResult visitFile(Path file, BasicFileAttributes attributes) throws IOException { System.out.println("Deleting " + file.getFileName()); Files.delete(file);//from ww w . j a v a 2 s. c o m return FileVisitResult.CONTINUE; }
From source file:Test.java
@Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) { if (file.toString().endsWith(".java")) { System.out.println(file.getFileName()); }/* w ww .j ava 2 s. c o m*/ return FileVisitResult.CONTINUE; }
From source file:org.libraryweasel.configmanager.JsonConfigManager.java
@Override public List<String> getConfigurations() { List<String> result = new ArrayList<>(); Path dir = pathsService.getInstancePath("config/"); try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir, "*.{json}")) { for (Path entry : stream) { result.add(entry.getFileName().toString()); }/*ww w.j a v a2s . c o m*/ } catch (IOException ex) { throw new RuntimeException(ex); } return result; }
From source file:org.bonitasoft.web.designer.repository.AbstractLoader.java
private String getComponentId(Path path) { return path.getFileName().toString().replaceAll("\\.\\w+", ""); }
From source file:ListFiles.java
@Override public FileVisitResult visitFile(Path file, BasicFileAttributes attributes) { indent();//from www . j a va 2s .co m System.out.println("Visiting file:" + file.getFileName()); return FileVisitResult.CONTINUE; }
From source file:DeleteDirectory.java
@Override public FileVisitResult postVisitDirectory(Path directory, IOException exception) throws IOException { if (exception == null) { System.out.println("Deleting " + directory.getFileName()); Files.delete(directory);/* w w w .j a v a2 s. c om*/ return FileVisitResult.CONTINUE; } else { throw exception; } }
From source file:com.me.jvmi.LuminateFTPClient.java
public String uploadProductImage(Path productImage) throws IOException { String filename = productImage.getFileName().toString(); String id = filename.split("_")[0]; return uploadProductImage(id, productImage); }
From source file:joachimeichborn.geotag.io.writer.kml.KmzWriter.java
public void write(final Track aTrack, final Path aOutputFile) throws IOException { final String documentTitle = FilenameUtils.removeExtension(aOutputFile.getFileName().toString()); final GeoTagKml kml = createKml(documentTitle, aTrack); kml.marshalAsKmz(aOutputFile.toString()); logger.fine("Wrote track to " + aOutputFile); }
From source file:com.github.rwhogg.git_vcr.BetterFileTypeDetector.java
/** * Provide a better implementation of probeContentType than we get on other platforms * @param path path to the file to determine the type of * @return The file's MIME type//w w w.ja v a 2s .c o m */ @Override public String probeContentType(Path path) throws IOException { return typeMap.get(FilenameUtils.getExtension(path.getFileName().toString())); }
From source file:its.tools.SonarlintProject.java
/** * Copies project to a temporary location and returns its root path. */// ww w . jav a 2 s . c o m public Path deployProject(String location) throws IOException { Path originalLoc = Paths.get("projects").resolve(location); String projectName = originalLoc.getFileName().toString(); if (!Files.isDirectory(originalLoc)) { throw new IllegalArgumentException( "Couldn't find project directory: " + originalLoc.toAbsolutePath().toString()); } cleanProject(); project = Files.createTempDirectory(projectName); FileUtils.copyDirectory(originalLoc.toFile(), project.toFile()); return project; }