Example usage for java.io File getName

List of usage examples for java.io File getName

Introduction

In this page you can find the example usage for java.io File getName.

Prototype

public String getName() 

Source Link

Document

Returns the name of the file or directory denoted by this abstract pathname.

Usage

From source file:Main.java

public static String getKmlSimpleFileName(File file) {
    String fileName = file.getName();
    if (fileName.endsWith(KML_FILE_ENDS)) {
        return fileName.substring(0, fileName.length() - KML_FILE_ENDS.length());
    } else {/*from ww  w .j a va  2s.  c o  m*/
        return fileName;
    }
}

From source file:Main.java

public static String getFilename(String filepath) {
    File file = new File(filepath);
    return file.getName().replace(".epub", "");
}

From source file:Main.java

public static String getFileName(URL url) {
    File f = new File(url.getFile());
    return f.getName();
}

From source file:Main.java

public static boolean isBamFile(final File file) {
    return ((file != null) && file.getName().endsWith(BAM_FILE_EXTENSION));
}

From source file:Main.java

public static String pegaNome(String nomeArquivo) {
    File arquivo = new File(nomeArquivo);
    return arquivo.getName();
}

From source file:Main.java

public static String getFileExtension(File file) {
    return getFileExtension(file.getName());
}

From source file:Main.java

public static String getFileExt(File file) {
    String fileName = file.getName();
    int i = fileName.lastIndexOf('.');
    if (i < 0) {
        return null;
    }/*from  ww  w  . jav  a 2  s .  co m*/
    return fileName.substring(i);
}

From source file:FileUtil.java

public static String getExtension(File file) {
    return getFileExtension(file.getName());
}

From source file:FileUtil.java

public static String getFileNameWithoutExtension(File file) {
    return StripFileExtension(file.getName());
}

From source file:Main.java

public static String getFileExtensionWithoutDot(File file) {
    return getFileExtensionWithoutDot(file.getName());
}