List of usage examples for org.apache.commons.io FilenameUtils getBaseName
public static String getBaseName(String filename)
From source file:ch.cyberduck.DuplicateFileController.java
@Override public void setFilenameField(String field) { super.setFilenameField(field); final Path selected = ((BrowserController) parent).getSelectedPath(); StringBuilder proposal = new StringBuilder(); proposal.append(FilenameUtils.getBaseName(selected.getName())); // proposal.append(" (").append(DateFormatter.getShortFormat(System.currentTimeMillis()).replace('/', ':')).append(")"); if (StringUtils.isNotEmpty(selected.getExtension())) { proposal.append(".").append(selected.getExtension()); }//from ww w .java2s . c o m this.setFilenameField(proposal.toString()); }
From source file:batch.OutputFileListener.java
@BeforeStep public void createOutputNameFromInput(StepExecution stepExecution) { ExecutionContext executionContext = stepExecution.getExecutionContext(); String inputName = stepExecution.getStepName().replace(":", "-"); if (executionContext.containsKey(inputKeyName)) { inputName = executionContext.getString(inputKeyName); }//from w w w.j a v a2 s .c o m if (!executionContext.containsKey(outputKeyName)) { executionContext.putString(outputKeyName, path + FilenameUtils.getBaseName(inputName) + ".csv"); } }
From source file:be.fedict.eid.applet.service.signer.odf.ODFEntityResolver.java
public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { LOG.debug("resolveEntity"); LOG.debug("publicId: " + publicId); LOG.debug("systemId: " + systemId); if ("-//OpenOffice.org//DTD Modified W3C MathML 1.01//EN".equals(publicId)) { InputStream mathmlDtdInputStream = ODFEntityResolver.class.getResourceAsStream("/mmlents/mathml.dtd"); InputSource inputSource = new InputSource(mathmlDtdInputStream); return inputSource; }/*from w w w .j a va 2s. com*/ if (systemId.endsWith(".ent")) { String filename = FilenameUtils.getBaseName(systemId); LOG.debug("ent filename: " + filename); InputStream entInputStream = ODFEntityResolver.class .getResourceAsStream("/mmlents/" + filename + ".ent"); InputSource inputSource = new InputSource(entInputStream); return inputSource; } LOG.warn("could not resolve: " + publicId); return null; }
From source file:annis.administration.MediaImportHelper.java
public MediaImportHelper(String absolutePath, File dataDir, long corpusRef, Map<String, String> mimeTypeMapping) { this.fileSource = new File(absolutePath); // create a file-name in the form of "filename-UUID.ending", thus we // need to split the file name into its components String baseName = FilenameUtils.getBaseName(fileSource.getName()); String extension = FilenameUtils.getExtension(fileSource.getName()); UUID uuid = UUID.randomUUID(); fileDestination = new File(dataDir, baseName + "_" + uuid.toString() + (extension.isEmpty() ? "" : "." + extension)); String fileEnding = FilenameUtils.getExtension(absolutePath); if (mimeTypeMapping.containsKey(fileEnding)) { this.mimeType = mimeTypeMapping.get(fileEnding); } else {//from w w w . ja va2s . co m this.mimeType = new MimetypesFileTypeMap().getContentType(fileSource); } this.corpusRef = corpusRef; }
From source file:de.dfki.resc28.ole.bootstrap.listener.UserListener.java
public UserListener(String fileName, IGraphStore graphStore) { super();//from w w w . j a v a2s.c o m this.fileName = fileName; this.basename = FilenameUtils.getBaseName(fileName); this.graphStore = graphStore; }
From source file:codes.thischwa.c5c.util.StringUtils.java
public static String getUniqueName(Set<String> existingNames, String name) { if (!existingNames.contains(name)) return name; int count = 1; String ext = FilenameUtils.getExtension(name); String baseName = FilenameUtils.getBaseName(name); String tmpName;// w w w. ja v a 2s . c o m do { tmpName = String.format("%s_%d", baseName, count); if (!_isNullOrEmpty(ext)) tmpName = String.format("%s.%s", tmpName, ext); count++; } while (existingNames.contains(tmpName)); return tmpName; }
From source file:MSUmpire.BaseDataStructure.TandemParam.java
@Override public void SetResultFilePath(String mzXMLfile) { SpectrumPath = FilenameUtils// w w w. j a v a2 s. co m .separatorsToUnix(FilenameUtils.getFullPath(mzXMLfile) + FilenameUtils.getName(mzXMLfile)); PepXMLPath = FilenameUtils.separatorsToUnix( FilenameUtils.getFullPath(mzXMLfile) + FilenameUtils.getBaseName(mzXMLfile) + ".tandem.pep.xml"); InteractPepXMLPath = FilenameUtils.separatorsToUnix(FilenameUtils.getFullPath(mzXMLfile) + "interact-" + FilenameUtils.getBaseName(mzXMLfile) + ".tandem.pep.xml"); ProtXMLPath = InteractPepXMLPath.replace(".pep.xml", ".prot.xml"); parameterPath = FilenameUtils.separatorsToUnix( FilenameUtils.getFullPath(mzXMLfile) + FilenameUtils.getBaseName(mzXMLfile) + ".tandem.param"); RawSearchResult = FilenameUtils.separatorsToUnix( FilenameUtils.getFullPath(mzXMLfile) + FilenameUtils.getBaseName(mzXMLfile) + ".tandem"); }
From source file:mpg.biochem.de.interbase.batch.OutputFileListener.java
@BeforeStep public void createOutputNameFromInput(StepExecution stepExecution) { ExecutionContext executionContext = stepExecution.getExecutionContext(); String inputName = stepExecution.getStepName().replace(":", "-"); if (executionContext.containsKey(inputKeyName)) { inputName = executionContext.getString(inputKeyName); }//from w ww . j a v a 2 s.c o m if (!executionContext.containsKey(outputKeyName)) { executionContext.putString(outputKeyName, path + FilenameUtils.getBaseName(inputName) + ".mapped.tab"); } }
From source file:com.gmail.frogocomics.schematic.McEditSchematicObject.java
/** * Load a new {@link McEditSchematic} from a {@link File}. * * @param file The file to load from./*from w w w . ja va 2 s.c o m*/ * @return Returns a new schematic, unless an exception happens. * @throws ParseException Exception for parsing errors. * @throws IOException When loading the file goes wrong. * @throws ClassicNotSupportedException An exception for classic schematics. */ public static McEditSchematicObject load(File file) throws ParseException, IOException, ClassicNotSupportedException { return new McEditSchematicObject(SchematicReader.readSchematicsFile(file), FilenameUtils.getBaseName(file.getAbsolutePath())); }
From source file:com.frostwire.search.torrentdownloads.TorrentDownloadsSearchResult.java
TorrentDownloadsSearchResult(String domainName, String detailsUrl, SearchMatcher matcher) { this.detailsUrl = detailsUrl; this.infoHash = null; this.filename = parseFileName(matcher.group("filename"), FilenameUtils.getBaseName(detailsUrl)); this.size = parseSize(matcher.group("filesize") + " " + matcher.group("unit")); this.creationTime = parseCreationTime(matcher.group("time")); this.seeds = parseSeeds(matcher.group("seeds")); this.torrentUrl = matcher.group("magnet"); this.displayName = HtmlManipulator.replaceHtmlEntities(FilenameUtils.getBaseName(filename)); }