Java Path File Name nio getFileName(String relativePath)

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

Description

get File Name

License

Open Source License

Declaration

public static String getFileName(String relativePath) throws IOException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.IOException;

import java.nio.file.Path;
import java.nio.file.Paths;

public class Main {
    public static String getFileName(String relativePath) throws IOException {
        Path path = Paths.get(relativePath);
        return path.getFileName().toFile().getName();
    }/*from ww w  .ja v a 2s .c  o  m*/
}

Related

  1. getFilename(final Path path)
  2. getFileName(Path path)
  3. getFileName(Path path)
  4. getFileName(String fullPath, boolean withParentFolder)
  5. getFileName(String path)
  6. getFileNameFromPath(String filePath)
  7. getFileNameFromPath(String str)
  8. getFilenameOrLastPath(String path)
  9. getFileNames(List fileNames, Path dir)