Java Relative Path Get relativize(File base, File child)

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

Description

Makes a file path relative to the base

License

Open Source License

Declaration

public static File relativize(File base, File child) 

Method Source Code


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

import java.io.File;

public class Main {
    /**//from  www  .  j av a 2s. c  o  m
     * Makes a file path relative to the base
     */
    public static File relativize(File base, File child) {
        return new File(base.toURI().relativize(child.toURI()).getPath());
    }
}

Related

  1. relativePath(String p_absolutePath, String p_currentPath)
  2. relativePathFiles(String relativePath, final String... fileNamesRegex)
  3. relativeTo(File peer, String filename)
  4. relativeToAbsoluteFilePath(String s)
  5. relativize(File base, File absolute)
  6. relativize(File file, File basedir)
  7. relativize(File home, File f)
  8. relativize(File path, File relative)
  9. relativize(final File root, final File target)