List of usage examples for org.apache.commons.io FilenameUtils getBaseName
public static String getBaseName(String filename)
From source file:codes.thischwa.c5c.impl.FilemanagerMessageResolver.java
@Override public void setServletContext(ServletContext servletContext) throws RuntimeException { PathBuilder path = new PathBuilder(PropertiesLoader.getFilemanagerPath()).addFolder(langPath); File msgFolder = new File(servletContext.getRealPath(path.toString())); if (!msgFolder.exists()) throw new RuntimeException("C5 scripts folder couldn't be found!"); ObjectMapper mapper = new ObjectMapper(); try {// ww w . java2s .c o m for (File file : msgFolder.listFiles(jsFilter)) { String lang = FilenameUtils.getBaseName(file.getName()); @SuppressWarnings("unchecked") Map<String, String> langData = mapper.readValue(file, Map.class); collectLangData(lang, langData); } } catch (Exception e) { throw new RuntimeException(e); } }
From source file:com.ibm.wala.cast.js.nodejs.NodejsRequiredCoreModule.java
protected NodejsRequiredCoreModule(File f, SourceFileModule clonedFrom) throws IOException { super(FilenameUtils.getBaseName(f.getName()), f, clonedFrom); }
From source file:io.servicecomb.core.definition.loader.SchemaLoader.java
/** * resource??schemaId.yaml//from w ww . j a v a 2s . c o m */ public SchemaMeta registerSchema(String microserviceName, Resource resource) { try { String schemaId = FilenameUtils.getBaseName(resource.getFilename()); String swaggerContent = IOUtils.toString(resource.getURL()); SchemaMeta schemaMeta = registerSchema(microserviceName, schemaId, swaggerContent); return schemaMeta; } catch (Throwable e) { throw new Error(e); } }
From source file:com.googlecode.l10nmavenplugin.model.BundlePropertiesFile.java
public BundlePropertiesFile(String fileName, Properties properties) { this.fileName = fileName; this.properties = properties; // Parse bundleName and locale String[] parts = FilenameUtils.getBaseName(fileName).split("_", 2); bundleName = parts[0];/*from w w w. j a va 2 s.co m*/ if (parts.length == 2) { this.locale = PropertiesFileUtils.getLocale(parts[1]); } }
From source file:ch.cyberduck.ui.cocoa.controller.CreateSymlinkController.java
@Override public NSView getAccessoryView(final NSAlert alert) { final NSView view = super.getAccessoryView(alert); this.updateField(inputField, FilenameUtils.getBaseName(selected.getName())); return view;/* www. j a va2s . c o m*/ }
From source file:edu.cornell.med.icb.goby.readers.sam.TestGobyPaperTop5000s.java
/** * Setup the filenames for a RoundTripAlignment in a standard fashion for the 5000 tests. * @param input the input sam/bam filename. Should end with .sam, .bam, or .sam.gz * @return a RoundTripAlignment with input and output filenames configured *//*from ww w .j a v a 2 s . com*/ private RoundTripAlignment setupRoundTrip(final String input) { final String basename; if (input.toLowerCase().endsWith(".gz")) { basename = FilenameUtils.getBaseName(FilenameUtils.getBaseName(input)); } else { basename = FilenameUtils.getBaseName(input); } final RoundTripAlignment rtc = new RoundTripAlignment(); rtc.sourceBamFilename = FilenameUtils.concat(BASE_TEST_INPUT_DIR, input); rtc.destGobyBasename = FilenameUtils.concat(BASE_TEST_OUTPUT_DIR, basename); rtc.destBamFilename = FilenameUtils.concat(BASE_TEST_OUTPUT_DIR, basename + ".sam"); return rtc; }
From source file:com.aliyun.odps.mapred.bridge.MockMetaExplorer.java
@Override public String addFileResourceWithRetry(String filePath, Type type, String padding, boolean isTempResource) throws OdpsException { return FilenameUtils.getBaseName(filePath) + padding + FilenameUtils.getExtension(filePath); }
From source file:ch.cyberduck.core.transfer.download.RenameExistingFilter.java
@Override public void apply(final Path file, final Local local, final TransferStatus status, final ProgressListener listener) throws BackgroundException { if (status.isExists()) { Local rename;// ww w. j a v a 2s . co m do { String proposal = MessageFormat.format( PreferencesFactory.get().getProperty("queue.download.file.rename.format"), FilenameUtils.getBaseName(file.getName()), UserDateFormatterFactory.get().getMediumFormat(System.currentTimeMillis(), false) .replace(local.getDelimiter(), '-').replace(':', '-'), StringUtils.isNotBlank(file.getExtension()) ? String.format(".%s", file.getExtension()) : StringUtils.EMPTY); rename = LocalFactory.get(local.getParent().getAbsolute(), proposal); } while (rename.exists()); if (log.isInfoEnabled()) { log.info(String.format("Rename existing file %s to %s", local, rename)); } local.rename(rename); if (log.isDebugEnabled()) { log.debug(String.format("Clear exist flag for file %s", local)); } status.setExists(false); } super.apply(file, local, status, listener); }
From source file:com.o2d.pkayjava.editor.utils.ImportUtils.java
public static int getImportType(String[] paths) { int mainType = TYPE_MIXED; String[] names = new String[paths.length]; for (int i = 0; i < paths.length; i++) { String path = paths[i];/*from www . j a v a2s .c om*/ int type = getFileType(path); if (i == 0) mainType = type; if (mainType != type) { return TYPE_MIXED; } names[i] = FilenameUtils.getBaseName(path); } if (mainType == TYPE_IMAGE) { // check they are a PNG sequence; boolean isSequence = isAnimationSequence(names); if (isSequence) { mainType = TYPE_ANIMATION_PNG_SEQUENCE; } } if (mainType > 0 && !ImportUtils.getInstance().supportedTypes.contains(mainType)) { mainType = TYPE_UNSUPPORTED; } return mainType; }
From source file:fi.johannes.kata.ocr.utils.structs.Filename.java
private void cacheStrings() { fullpath = FilenameUtils.getFullPath(absolutePath.toString()); name = FilenameUtils.getBaseName(absolutePath.toString()); extension = FilenameUtils.getExtension(absolutePath.toString()); }