Java File Name Get getFileName(String absolutePath)

Here you can find the source of getFileName(String absolutePath)

Description

get File Name

License

Open Source License

Declaration

public static String getFileName(String absolutePath) 

Method Source Code

//package com.java2s;

import java.io.File;

public class Main {

    public static String getFileName(String absolutePath) {
        if (!isExist(absolutePath)) {
            return null;
        }//  w w  w .ja  va  2  s.c o m
        File file = new File(absolutePath);
        return file.getName();
    }

    public static boolean isExist(String path) {
        return new File(path).exists();
    }
}

Related

  1. getFilename(final String filenamePath)
  2. getFileName(final String p)
  3. getFilename(final String pPath)
  4. getFileName(final String subdirectory)
  5. getFilename(Locale locale, String fileName, String fileType)
  6. getFileName(String completePath)
  7. getFileName(String dir, String name)
  8. getFileName(String f)
  9. getFileName(String fileName)