List of usage examples for org.apache.commons.io FilenameUtils removeExtension
public static String removeExtension(String filename)
From source file:ch.unibas.fittingwizard.application.xyz.ZxyGenerator.java
private File prepareFile(File coordinateFile) { return new File(coordinateFile.getParentFile(), FilenameUtils.removeExtension(coordinateFile.getName()) + zxyExtension); }
From source file:joachimeichborn.geotag.io.writer.kml.KmlWriter.java
/** * Create the output KML file containing: * <ul>/*from w w w . ja va 2 s . c om*/ * <li>placemarks for all positions * <li>a path connecting all positions in chronological order * <li>circles showing the accuracy information for all positions * </ul> * * @throws IOException */ 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); try (final Writer kmlWriter = new OutputStreamWriter( new BufferedOutputStream(new FileOutputStream(aOutputFile.toFile())), StandardCharsets.UTF_8)) { kml.marshal(kmlWriter); } logger.fine("Wrote track to " + aOutputFile); }
From source file:com.sap.prd.mobile.ios.mios.FrameworkStructureValidator.java
/** * //w ww . j a v a2 s. c o m * @return a non <code>null</code> list containing the validation errors. The list is empty if the * framework has a valid structure. */ public List<String> validate() { errorMsgs = new ArrayList<String>(); if (!fmwkDir.isDirectory()) { errorMsgs.add("'" + fmwkDir.getAbsolutePath() + "' is not a directory"); } else { validateSubdirExistence("Versions", "Versions/A", "Versions/A/Headers", "Versions/A/Resources"); String fmwkName = FilenameUtils.removeExtension(fmwkDir.getName()); validateLib("Versions/A/" + fmwkName); validateLink("Headers", "Versions/A/Headers"); validateLink("Resources", "Versions/A/Resources"); validateLink(fmwkName, "Versions/A/" + fmwkName); validateLink("Versions/Current", "Versions/A"); } return errorMsgs; }
From source file:com.itemanalysis.jmetrik.stats.itemanalysis.ItemAnalysisOutputFile.java
private File getUniqueFile(File file) throws IOException { String s = FilenameUtils.removeExtension(file.getAbsolutePath()); File file2 = new File(s + ".jmetrik"); if (file2.exists()) { s = s.replaceAll("\\d*$", ""); s += fileCount + ".jmetrik"; fileCount++;/*from w ww. j ava 2 s. co m*/ getUniqueFile(new File(s)); } else { file2.createNewFile(); } return file2; }
From source file:com.fileOperations.WordToPDF.java
/** * Creates PDF from DOCX, does this by opening file and "SaveAs" within * Microsoft Office itself and closing out. * * @param filePath String// w ww . j a v a 2s. c o m * @param fileName String * @return String - new File Name */ public static String createPDFNoDelete(String filePath, String fileName) { ActiveXComponent eolWord = null; String docxFile = filePath + fileName; String pdfFile = filePath + FilenameUtils.removeExtension(fileName) + ".pdf"; File attachmentLocation = new File(filePath); if (!attachmentLocation.exists()) { attachmentLocation.mkdirs(); } eolWord = JacobCOMBridge.setWordActive(true, false, eolWord); if (eolWord != null) { try { //Open MS Word & Save AS Dispatch document = eolWord.getProperty("Documents").toDispatch(); Dispatch.call(document, "Open", docxFile).toDispatch(); Dispatch WordBasic = Dispatch.call(eolWord, "WordBasic").getDispatch(); Dispatch.call(WordBasic, "FileSaveAs", pdfFile, new Variant(17)); Dispatch.call(document, "Close", new Variant(false)); Thread.sleep(250); //Close out MS Word JacobCOMBridge.setWordActive(false, false, eolWord); Dispatch.call(eolWord, "Quit"); eolWord.safeRelease(); Thread.sleep(250); return FilenameUtils.getName(pdfFile); } catch (InterruptedException ex) { ExceptionHandler.Handle(ex); return ""; } } return ""; }
From source file:avantssar.aslanpp.testing.BackendTask.java
public void run() { //int idx = 0; synchronized (nextIndex) { //idx = nextIndex; nextIndex++;/*from w w w.ja v a 2 s .c o m*/ } System.out.print("+"); String runnerPrefix = FilenameUtils.removeExtension(aslanFile.getAbsolutePath()) + "." + runner.getName().replaceAll("[^a-zA-Z0-9]", "").toLowerCase(); File outputFile = new File(runnerPrefix + ".output.txt"); File errorsFile = new File(runnerPrefix + ".errors.txt"); try { PrintStream captureOutput = new PrintStream(outputFile); PrintStream captureErrors = new PrintStream(errorsFile); // runner.purgeParameters(); // for (String p : parameters) { // runner.addParameter(p); // } Verdict v = runner.analyze(aslanFile, parameters, captureOutput, captureErrors); captureOutput.close(); captureErrors.close(); outputFile = Tester.deleteIfZero(outputFile); errorsFile = Tester.deleteIfZero(errorsFile); ti.putVerdict(runner, v, outputFile, errorsFile); } catch (FileNotFoundException e) { ti.putVerdict(runner, Verdict.Error, null, null); } System.out.print("-"); }
From source file:com.ariht.maven.plugins.config.io.FileInfo.java
public String getNameWithoutExtension() { return FilenameUtils.removeExtension(file.getName()); }
From source file:com.google.api.ads.adwords.awreporting.exporter.reportwriter.FileSystemReportWriter.java
/** * Generates the report filename, based on template file names * dates and accountId/*from w w w.ja v a 2 s .c o m*/ * * @param htmlTemplateFile the template file to generete the report * @param dateStart the start date for the reports * @param dateEnd the end date for the reports * @param accountId the account CID to generate the Report for * @param outputDirectory where to output the files * @param reportFileType either PDF or HTML * @throws IOException */ public static FileSystemReportWriter newFileSystemReportWriter(String templateName, String dateStart, String dateEnd, Long accountId, File outputDirectory, ReportFileType reportFileType) throws IOException { String fileNameWithOutExt = FilenameUtils.removeExtension((templateName)); String reportFileName = fileNameWithOutExt + "_" + accountId + "_" + dateStart + "_" + dateEnd + "." + reportFileType.toString().toLowerCase(); return new FileSystemReportWriter(new File(outputDirectory, reportFileName)); }
From source file:com.baran.file.FileOperator.java
public static String uniqueNameGenerator(String inputFile) { // randomization SecureRandom random = new SecureRandom(); BigInteger bi = new BigInteger(130, random); String uniqueEncFile = String.valueOf((BigInteger) bi); // commons-io-2.4.jar String fileNameWithOutExt = FilenameUtils.removeExtension(inputFile); String randomFileName = System.getProperty("user.dir") + "\\" + fileNameWithOutExt + "_" + uniqueEncFile + ".enc"; return randomFileName; }
From source file:edu.scripps.fl.pubchem.promiscuity.servlet.PCPromiscuityRunnable.java
public void run() { try {/*from w ww .j a va 2s.co m*/ Map<Long, CompoundPromiscuityInfo> map = new PCPromiscuityMain(params).getCompoundPromiscuityInfoMap(); PCPromiscuityOutput output = new PCPromiscuityOutput(); output.compoundPromiscuityToXML(map, params, tmpFile); String csvName = FilenameUtils.removeExtension(tmpFile.getAbsolutePath()) + ".csv"; File file = new File(csvName); output.compoundPromiscuityToCSV(map, params, file); } catch (Exception e) { e.printStackTrace(); } }