Java Path Relative nio getRelativePath(String relativePathFile)

Here you can find the source of getRelativePath(String relativePathFile)

Description

get Relative Path

License

Open Source License

Declaration

public static String getRelativePath(String relativePathFile) 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 getRelativePath(String relativePathFile) throws IOException {
        Path path = Paths.get(relativePathFile);
        return path.getFileName().toFile().getAbsolutePath();
    }/*from  ww w .  j  a v  a2 s  .c  om*/

    public static String getFileName(String relativePath) throws IOException {
        Path path = Paths.get(relativePath);
        return path.getFileName().toFile().getName();
    }
}

Related

  1. getRelativePath(final File file, final File baseDir)
  2. getRelativePath(Path file, Path baseDir)
  3. getRelativePath(Path rootPath, Path path)
  4. getRelativePath(String file, String directory)
  5. getRelativePath(String fullPath, String homeFolderPath)
  6. getSourceFileRelativePath(Class declaringClass)
  7. isRelativePath(Path baseDir, Path file)
  8. isRelativized(final Path base, final String successor)
  9. relativePath(String input, String mainurl)