Example usage for org.apache.commons.io FilenameUtils getBaseName

List of usage examples for org.apache.commons.io FilenameUtils getBaseName

Introduction

In this page you can find the example usage for org.apache.commons.io FilenameUtils getBaseName.

Prototype

public static String getBaseName(String filename) 

Source Link

Document

Gets the base name, minus the full path and extension, from a full filename.

Usage

From source file:com.notes.listen.FsWatchService.java

@Subscribe
@AllowConcurrentEvents/*from www .  j  a v a2  s.  co  m*/
public void proc(PathEvent event) {
    try {

        Path path = event.getEventTarget();
        String fileName = FilenameUtils.concat("D:\\temp\\", path.toString());
        if (fileName.endsWith(".aspx")) {

            String fullPath = FilenameUtils.getFullPath(fileName);
            String srcName = FilenameUtils.getBaseName(fileName);

        }
    } catch (Error e) {
        e.printStackTrace();
    }

}

From source file:com.orange.ocara.model.export.docx.CommentPresenter.java

public String getAttachmentName() {

    switch (getType()) {
    case AUDIO: {
        String baseName = FilenameUtils.getBaseName(value.getAttachment());
        return notNull(String.format("%s.bin", baseName));
    }//w  ww. ja  v  a 2  s.  co m

    default:
        return notNull(FilenameUtils.getName(value.getAttachment()));
    }

}

From source file:info.bonjean.beluga.util.ResourcesUtil.java

public static SVGIcon getSVGIcon(String resource) throws IOException {
    SVGUniverse universe = SVGCache.getSVGUniverse();
    URI uri = universe.loadSVG(Notification.class.getResourceAsStream(resource),
            SVG_NAME_PREFIX + FilenameUtils.getBaseName(resource));
    SVGIcon svgIcon = new SVGIcon();
    svgIcon.setSvgURI(uri);//from w ww .j  av a 2  s  . c  om
    return svgIcon;
}

From source file:AIR.Common.Utilities.Path.java

public static String getFileNameWithoutExtension(String fileName) {
    return FilenameUtils.getBaseName(fileName);
}

From source file:com.googlecode.dex2jar.v3.Main.java

public static void doFile(File srcDex) throws IOException {
    doFile(srcDex,//  w ww .  ja v  a  2  s. c  om
            new File(srcDex.getParentFile(), FilenameUtils.getBaseName(srcDex.getName()) + "_dex2jar.jar"));
}

From source file:com.googlecode.dex2jar.test.ASMifierTest.java

@Test
public void test() throws Exception {
    try {//from w  w w .ja v a2 s  .com
        for (File f : TestUtils.listTestDexFiles(true)) {
            System.out.println("asmifier file " + f);
            File distDir = new File(f.getParentFile(), FilenameUtils.getBaseName(f.getName()) + "_asmifier");
            doData(TestUtils.initDexFileReader(f), distDir);
        }
    } catch (Exception e) {
        Main.niceExceptionMessage(e, 0);
        throw e;
    }
}

From source file:fr.avianey.androidsvgdrawable.QualifiedResource.java

/**
 * Create a {@link QualifiedResource} from an input SVG file.
 * @param file//ww w  . ja  v a2  s.c  om
 * @return
 */
public static final QualifiedResource fromFile(final File file) {
    Preconditions.checkNotNull(file);
    final String fileName = FilenameUtils.getBaseName(file.getAbsolutePath());
    Preconditions.checkArgument(fileName.length() > 0);
    Preconditions.checkArgument(fileName.indexOf("-") > 0);

    // unqualified name
    final String unqualifiedName = fileName.substring(0, fileName.indexOf("-"));
    Preconditions.checkArgument(unqualifiedName != null && unqualifiedName.matches("\\w+"));

    // qualifiers
    final EnumMap<Type, String> typedQualifiers = Qualifier
            .fromQualifiedString(fileName.substring(fileName.indexOf("-") + 1));

    // a density qualifier must be provided
    Preconditions.checkNotNull(typedQualifiers.get(Type.density));

    return new QualifiedResource(file, unqualifiedName, typedQualifiers);
}

From source file:com.ftb2om2.util.Zipper.java

public void createOSZ(String mp3Path, String outputPath, List<Difficulty> difficulty) throws IOException {
    FileOutputStream fos = new FileOutputStream(
            outputPath + "\\" + FilenameUtils.getBaseName(mp3Path) + ".osz");
    ZipOutputStream zos = new ZipOutputStream(fos);

    addToZip(mp3Path, "Audio.mp3", zos);

    difficulty.forEach(file -> {/*from w  w w  . ja  v  a 2s  . c o  m*/
        try {
            addToZip(outputPath + "\\" + file.getDifficultyName() + ".osu", file.getDifficultyName() + ".osu",
                    zos);
        } catch (IOException ex) {
            throw new UncheckedIOException(ex);
        }
    });

    zos.close();
    fos.close();
}

From source file:com.frostwire.android.gui.transfers.AzureusBittorrentDownloadItem.java

public AzureusBittorrentDownloadItem(VuzeFileInfo info) {
    this.info = info;
    this.displayName = FilenameUtils.getBaseName(info.getFilename());
}

From source file:com.alta189.bukkit.script.ScriptLoader.java

public Script loadScript(Context context, Scriptable scope, File file) throws Exception {
    String contents = FileUtils.readFileToString(file);
    String name = FilenameUtils.getBaseName(file.getName());

    context.evaluateString(scope, "importPackage(org.bukkit);", name, 1, null);

    if (Bukkit.getPluginManager().getPlugin("Spout") != null) {
        context.evaluateString(scope, "importPackage(org.getspout.spoutapi);", name, 1, null);
    }//  www .j  ava2 s  . c  om

    context.evaluateString(scope, "var info = {};", name, 1, null);
    context.evaluateString(scope, contents, name, 1, null);

    Scriptable infoObject = CastUtil.safeCast(ScriptableObject.getProperty(scope, "info"));
    ScriptInfo info = new ScriptInfo(infoObject);
    if (info.getName() != null) {
        info.setName(name);
    }

    return new Script(file, info);
}