List of usage examples for org.apache.commons.io FilenameUtils getName
public static String getName(String filename)
From source file:io.wcm.devops.conga.resource.AbstractClasspathResourceImpl.java
@Override public final String getName() { return FilenameUtils.getName(path); }
From source file:com.frostwire.search.pixabay.PixabayImageSearchResult.java
PixabayImageSearchResult(PixabayItem item) { super(item); this.displayName = FilenameUtils.getName(item.previewURL); this.filename = displayName; }
From source file:eu.novait.imageresizer.helpers.ImageFile.java
public String getOutputFilename(String outputdir) { String newname = ""; if (!outputdir.endsWith("/") && !outputdir.endsWith("\"")) { outputdir += "/"; }//from w w w . j av a 2 s . c o m File f = new File(this.filename); String basename = FilenameUtils.getName(filename); String ext = FilenameUtils.getExtension(basename); String onlyname = FilenameUtils.getBaseName(filename); newname = outputdir + basename; File outputfile = new File(newname); while (outputfile.exists()) { int idx = 1; newname = outputdir + onlyname + "_" + Integer.toString(idx) + "." + ext; outputfile = new File(newname); idx++; } return newname; }
From source file:com.curso.ejemplohinputfile.FileUploadBean.java
public String processFileUpload() throws IOException { Part uploadedFile = getFile();/*from w w w. j av a 2s .com*/ final Path destination = Paths.get("c:/tmp/" + FilenameUtils.getName(getSubmittedFileName(uploadedFile))); //Con servlet 3.1 //final Path destination = Paths.get("c:/tmp/"+ FilenameUtils.getName(uploadedFile.getSubmittedFileName())); InputStream bytes = null; if (null != uploadedFile) { bytes = uploadedFile.getInputStream(); // Files.copy(bytes, destination); } return "success"; }
From source file:net.sf.jvifm.control.MoveCommand.java
protected void doFileOperator(String src, String dst, String fileName) throws Exception { if (Thread.currentThread().isInterrupted()) return;/*w w w. j a v a2 s. c om*/ String baseName = FilenameUtils.getName(src); updateStatusInfo("moving file " + baseName); fileModelManager.mv(src, dst); }
From source file:com.fileOperations.TXTtoPDF.java
/** * creates PDF from text document// w w w . ja v a2 s . com * * @param filePath String * @param fileName String * @return String - new File Name */ public static String createPDFNoDelete(String filePath, String fileName) { String txtFile = filePath + fileName; String pdfFile = filePath + FilenameUtils.removeExtension(fileName) + ".pdf"; File attachmentLocation = new File(filePath); if (!attachmentLocation.exists()) { attachmentLocation.mkdirs(); } makePDF(pdfFile, getTextfromTXT(txtFile)); return FilenameUtils.getName(pdfFile); }
From source file:edu.harvard.hul.ois.fits.tools.utils.XsltFunctions.java
public static String getFileNameFromUrl(String url) { return FilenameUtils.getName(url); }
From source file:com.bt.download.android.gui.transfers.TorrentUrlInfo.java
@Override public String getDisplayName() { return FilenameUtils.getName(url); }
From source file:com.kamike.misc.FsNameUtils.java
public static String getName(String disk, String filename, String fid, String uid, Date date) { String name = FilenameUtils.getName(filename); String prefix = FilenameUtils.getPrefix(filename); String extension = FilenameUtils.getExtension(filename); //?// www. j a v a 2 s .co m return getName(prefix, disk, getShortDate(date), name, fid, uid, extension); }
From source file:com.ibm.soatf.component.soap.builder.ResourceUtils.java
private static Path parsePath(String resourcePath) { if (resourcePath == null) { throw new NullPointerException("resourcePath cannot be null"); }//from w ww. j ava 2 s. c om Path path = new Path(); path.packagePath = getFullPath(resourcePath); path.resourcePath = FilenameUtils.getName(resourcePath); return path; }