Java Path Relative Get getRelativePath(final File base, final File child)

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

Description

get Relative Path

License

LGPL

Declaration

public static String getRelativePath(final File base, final File child) 

Method Source Code


//package com.java2s;
//License from project: LGPL 

import java.io.File;

public class Main {
    public static String getRelativePath(final File base, final File child) {
        if (base == null || child == null) {
            throw new IllegalArgumentException("Cannot be null.");
        }// ww w  .  j  a  v  a 2 s  .  c om
        return base.toURI().relativize(child.toURI()).getPath();
    }
}

Related

  1. getRelativePath(File src, File dst)
  2. getRelativePath(File subj, File relativeTo)
  3. getRelativePath(File target, File base)
  4. getRelativePath(File target, File relativeTo)
  5. getRelativePath(File wd, File file)
  6. getRelativePath(final File base, final File name)
  7. getRelativePath(final File baseDirectory, final File f)
  8. getRelativePath(final File basePathFile, final File pathFile)
  9. getRelativePath(final File file, final File folder)