Example usage for org.apache.hadoop.fs Path mergePaths

List of usage examples for org.apache.hadoop.fs Path mergePaths

Introduction

In this page you can find the example usage for org.apache.hadoop.fs Path mergePaths.

Prototype

public static Path mergePaths(Path path1, Path path2) 

Source Link

Document

Merge 2 paths such that the second path is appended relative to the first.

Usage

From source file:org.shaf.core.io.Location.java

License:Apache License

/**
 * Returns the absolute path to this location, which combines base and
 * relative paths./*  ww  w  .  j  ava  2  s  .  c  om*/
 * 
 * @return the absolute path to this location.
 */
private final Path getAbsolutePath() {
    return Path.mergePaths(base, path);
}

From source file:org.shaf.core.io.Location.java

License:Apache License

/**
 * Resolve the given path against this location.
 * //from   w w  w . j  av  a  2 s.c o  m
 * @param others
 *            the paths to resolve against this location.
 * @return the location with resulting path.
 */
public final Location resolve(final Path... others) {
    Path rel = this.path;
    for (Path other : others) {
        if (other.isAbsolute()) {
            rel = Path.mergePaths(rel, other);
        } else {
            rel = Path.mergePaths(rel, new Path("/", other));
        }
    }
    return new Location(this.fs, this.base, rel, this.filter);
}