Java Utililty Methods File Name Get

List of utility methods to do File Name Get

Description

The list of methods to do File Name Get are organized into topic(s).

Method

StringgetFileName(final File file)
get File Name
String result = null;
if (file != null) {
    try {
        result = file.getCanonicalPath();
    } catch (final IOException ioe) {
        result = file.toString();
return (result);
StringgetFilename(final File file)
get Filename
return file.getName().substring(0, file.getName().lastIndexOf(EXTENSION_SEPARATOR));
StringgetFileName(final File file)
get File Name
String result = null;
if (file != null) {
    result = file.getAbsolutePath();
return (result);
StringgetFilename(final String filenamePath)
Retourniert Dateinamen ohne Pfad als String
String correctFilenamePath = getCorrectSeparators(filenamePath);
if (correctFilenamePath.indexOf(DIRECTORY_SEPARATOR) < 0) {
    return filenamePath;
return correctFilenamePath.substring(correctFilenamePath.lastIndexOf(DIRECTORY_SEPARATOR) + 1,
        correctFilenamePath.length());
StringgetFileName(final String p)
get File Name
return getFileName(new File(p));
StringgetFilename(final String pPath)
Extracts the filename of a complete filename path.
return getFilename(pPath, File.separatorChar);
StringgetFileName(final String subdirectory)
get File Name
return new File(subdirectory).getName();
StringgetFilename(Locale locale, String fileName, String fileType)
Get the appropriate localized version of a file according to language settings e.
String localizedFileName = null;
boolean fileFound = false;
String fileNameLCV = null;
String fileNameLC = null;
String fileNameL = null;
fileNameL = fileName + "_" + locale.getLanguage();
if (fileType == null) {
    fileType = "";
...
StringgetFileName(String absolutePath)
get File Name
if (!isExist(absolutePath)) {
    return null;
File file = new File(absolutePath);
return file.getName();
StringgetFileName(String completePath)
Gets the fileName from the complete path
if (completePath == null)
    return null;
return completePath.substring(completePath.lastIndexOf(File.separator) + 1, completePath.length());