Java Path Relative Get getRelativePath(File base, File path)

Here you can find the source of getRelativePath(File base, File path)

Description

get Relative Path

License

Open Source License

Declaration

public static String getRelativePath(File base, File path) 

Method Source Code


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

import java.io.File;
import java.io.IOException;

public class Main {
    public static String getRelativePath(File base, File path) {
        try {/*from  w w  w  . java  2  s  .co  m*/
            String relative = base.getCanonicalFile().toURI().relativize(path.getCanonicalFile().toURI()).getPath();
            return relative;
        } catch (IOException e) {
            return null;
        }
    }
}

Related

  1. getRelativePath(File base, File file)
  2. getRelativePath(File base, File file)
  3. getRelativePath(File base, File name)
  4. getRelativePath(File base, File name)
  5. getRelativePath(File base, File path)
  6. getRelativePath(File base, File target)
  7. getRelativePath(File baseDir, File file)
  8. getRelativePath(File baseDir, File file)
  9. getRelativePath(File baseDir, File file)