List of usage examples for org.apache.commons.io FilenameUtils getBaseName
public static String getBaseName(String filename)
From source file:com.frostwire.search.youtube.YouTubeSearchResult.java
YouTubeSearchResult(String link, String title, String duration, String user) { this.filename = title + ".youtube"; this.displayName = FilenameUtils.getBaseName(filename); this.creationTime = -1; if (link.startsWith("/")) { link = link.substring(1);/* www .j a v a2s .c o m*/ } this.videoUrl = (link.startsWith("https://www.youtube.com/")) ? link : "https://www.youtube.com/" + link; this.user = user; this.source = "YouTube - " + user; this.size = buildSize(duration); this.thumbnailUrl = "http://img.youtube.com/vi/" + YouTubeExtractor.getVideoID(videoUrl) + "/hqdefault.jpg"; }
From source file:com.frostwire.gui.library.tags.AbstractTagParser.java
protected TagsData sanitize(int duration, String bitrate, String title, String artist, String album, String comment, String genre, String track, String year) { if (title == null || title.length() == 0) { title = FilenameUtils.getBaseName(file.getAbsolutePath()); }// w w w . ja va 2 s .com if (duration < 0) { duration = 0; } if (artist == null) { artist = ""; } if (album == null) { album = ""; } if (bitrate == null) { bitrate = ""; } if (comment == null) { comment = ""; } if (genre == null) { genre = ""; } else { genre = genre.replaceFirst("\\(.*\\)", ""); } if (track == null) { track = ""; } else { int index = -1; index = track.indexOf('/'); if (index != -1) { track = track.substring(0, index); } } if (year == null) { year = ""; } return new TagsData(duration, bitrate, title, artist, album, comment, genre, track, year); }
From source file:com.frostwire.search.archiveorg.ArchiveorgCrawledSearchResult.java
public ArchiveorgCrawledSearchResult(ArchiveorgSearchResult sr, ArchiveorgFile file) { super(sr);//from w w w. jav a 2s.c om this.filename = FilenameUtils.getName(file.filename); this.displayName = FilenameUtils.getBaseName(filename) + " (" + sr.getDisplayName() + ")"; this.downloadUrl = String.format(Locale.US, DOWNLOAD_URL, sr.getDomainName(), sr.getIdentifier(), UrlUtils.encode(file.filename)); this.size = calcSize(file); }
From source file:de.tudarmstadt.ukp.dkpro.core.testing.IOTestRunner.java
public static void testOneWay(Class<? extends CollectionReader> aReader, String aExpectedFile, String aFile, Object... aExtraParams) throws Exception { String outputFolder = aReader.getSimpleName() + "-" + FilenameUtils.getBaseName(aFile); if (DkproTestContext.get() != null) { outputFolder = DkproTestContext.get().getTestOutputFolderName(); }//from w ww. ja v a 2 s . c o m File output = new File("target/test-output/" + outputFolder + "/dump.txt"); Object[] extraParams = aExtraParams; extraParams = ArrayUtils.add(extraParams, CasDumpWriter.PARAM_TARGET_LOCATION); extraParams = ArrayUtils.add(extraParams, output); extraParams = ArrayUtils.add(extraParams, CasDumpWriter.PARAM_SORT); extraParams = ArrayUtils.add(extraParams, true); testOneWay2(aReader, CasDumpWriter.class, aExpectedFile, "dump.txt", aFile, extraParams); }
From source file:com.jaeksoft.searchlib.config.ConfigFileRotation.java
protected ConfigFileRotation(File directory, String masterName) { String ext = FilenameUtils.getExtension(masterName); String baseName = FilenameUtils.getBaseName(masterName); init(directory, masterName, baseName + "_tmp." + ext, baseName + "_old." + ext); }
From source file:com.googlecode.dex2jar.test.V3Test.java
@Test public void test() throws Exception { try {//from w w w.j a v a 2 s. com for (File f : TestUtils.listTestDexFiles()) { System.out.println("dex2jar file " + f); File distDir = new File("target", FilenameUtils.getBaseName(f.getName()) + "_dex2jar"); doData(DexFileReader.readDex(f), distDir); } } catch (Exception e) { Main.niceExceptionMessage(e, 0); throw e; } }
From source file:controllers.PdfGenerator.java
public void addTemporaryFonts(List<String> fontsToLoad) { if (defaultFonts == null) defaultFonts = new ArrayList<String>(); for (String font : fontsToLoad) { try {/* w w w . j ava2s . co m*/ InputStream fin = Play.application().resourceAsStream(font); final File tempFile = File.createTempFile("tmp_" + FilenameUtils.getBaseName(font), "." + FilenameUtils.getExtension(font)); tempFile.deleteOnExit(); FileOutputStream out = new FileOutputStream(tempFile); IOUtils.copy(fin, out); defaultFonts.add(tempFile.getAbsolutePath()); } catch (Exception e) { Logger.error("Loading fonts", e); } } }
From source file:de.dfki.resc28.ole.bootstrap.listener.LdrawDistributionListener.java
public LdrawDistributionListener(String fileName, IGraphStore graphStore) { super();/*from w ww .j av a2 s.c o m*/ this.basename = FilenameUtils.getBaseName(fileName); this.graphStore = graphStore; this.fileName = fileName; }
From source file:com.tao_harmony.fx2extend.journal.JournalUtil.java
/** * ?????./*from ww w . j a v a2 s .com*/ * * @param journals * * @param fileName * ? * @throws NoListException * ?Null?????? * @throws FileNameEmptyException * ???Null?????? * @throws IOException * ??????? */ public static void saveJournals(List<Journal> journals, String fileName) throws NoListException, FileNameEmptyException, IOException { // Null? if (journals == null) { throw new NoListException(); } // ?? if (journals.isEmpty()) { throw new NoListException(); } // ???? if (StringUtils.isBlank(fileName) || StringUtils.isBlank(FilenameUtils.getName(fileName))) { throw new FileNameEmptyException(); } // ?.slp??? String name = FilenameUtils.getFullPath(fileName) + FilenameUtils.getBaseName(fileName) + ".slp"; // ? CsvManager csvManager = new CsvEntityManager(); //CsvManager csvManager = CsvManagerFactory.newCsvManager(); csvManager.save(journals, Journal.class).to(new File(name)); }
From source file:ijfx.core.overlay.io.OverlayIOService.java
default void saveOverlaysNextToFile(List<Overlay> overlay, File imageFile) throws IOException { String filename = FilenameUtils.getBaseName(imageFile.getName()) + OVERLAY_FILE_EXTENSION; saveOverlays(overlay, new File(imageFile.getParentFile(), filename)); }