Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.huguesjohnson
Class PathResolver

    java.lang.Object
      com.huguesjohnson.PathResolver

    public abstract class PathResolver

extends java.lang.Object

Utility class to resolve full and absolute paths

Author:
  Hugues Johnson

Field Summary
`static java.lang.String` | `PARENT_PATH` public final static String PARENT_PATH="..";
`static java.lang.String` | `SELF_PATH` public final static String SELF_PATH=".";

Constructor Summary
`PathResolver()`

Method Summary
`static java.lang.String` | `getAbsolutePath(java.lang.String absolutePath, java.lang.String relativePath)` Resolves an absolute path against a relative path to get an absolute path. Case insensitive Examples of input/output combinations: absolutePath="c:\\folder1\\" relativePath=".\\sub-folder1\\" getAbsolutePath="c:\\folder1\\sub-folder1\\" absolutePath="c:\\folder1\\sub-folder1\\" relativePath="..\\..\\folder2\\" getAbsolutePath="c:\\folder2\\" absolutePath="c:\\folder1\\sub-folder1\\" relativePath="..\\..\\folder2\\file.txt" getAbsolutePath="c:\\folder2\\file.txt"
`static java.lang.String` | `getRelativePath(java.lang.String absolutePath1, java.lang.String absolutePath2)` Resolves an absolute path against another to get a relative path. Case insensitive Examples of input/output combinations: absolutePath1="c:\\folder1\\" absolutePath2="c:\\folder1\\sub-folder1\\" getRelativePath=".\\sub-folder1\\" absolutePath1="c:\\folder1\\" absolutePath2="c:\\folder1\\sub-folder1\\file.txt" getRelativePath=".\\sub-folder1\\file.txt" absolutePath1="c:\\folder1\\sub-folder1\\" absolutePath2="c:\\folder2\\" getRelativePath="..\\..\\folder2\\" If the drives are different then an absolute path must be returned. For example: absolutePath1="c:\\folder1\\" absolutePath2="d:\\folder2\\" getRelativePath="d:\\folder2\\"

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### PARENT_PATH

    public static final java.lang.String PARENT_PATH

  public final static String PARENT_PATH="..";

  See Also:
    Constant Field Values

### SELF_PATH

    public static final java.lang.String SELF_PATH

  public final static String SELF_PATH=".";

  See Also:
    Constant Field Values

Constructor Detail

### PathResolver

    public PathResolver()

Method Detail

### getRelativePath

    public static final java.lang.String getRelativePath(java.lang.String absolutePath1,
                                                         java.lang.String absolutePath2)

  Resolves an absolute path against another to get a relative path.
  Case insensitive
  Examples of input/output combinations:
  - absolutePath1="c:\\folder1\\" absolutePath2="c:\\folder1\\sub-folder1\\" getRelativePath=".\\sub-folder1\\"
  - absolutePath1="c:\\folder1\\" absolutePath2="c:\\folder1\\sub-folder1\\file.txt" getRelativePath=".\\sub-folder1\\file.txt"
  - absolutePath1="c:\\folder1\\sub-folder1\\" absolutePath2="c:\\folder2\\" getRelativePath="..\\..\\folder2\\"
  If the drives are different then an absolute path must be returned.
  For example: absolutePath1="c:\\folder1\\" absolutePath2="d:\\folder2\\" getRelativePath="d:\\folder2\\"

### getAbsolutePath

    public static final java.lang.String getAbsolutePath(java.lang.String absolutePath,
                                                         java.lang.String relativePath)

  Resolves an absolute path against a relative path to get an absolute path.
  Case insensitive
  Examples of input/output combinations:
  - absolutePath="c:\\folder1\\" relativePath=".\\sub-folder1\\" getAbsolutePath="c:\\folder1\\sub-folder1\\"
  - absolutePath="c:\\folder1\\sub-folder1\\" relativePath="..\\..\\folder2\\" getAbsolutePath="c:\\folder2\\"
  - absolutePath="c:\\folder1\\sub-folder1\\" relativePath="..\\..\\folder2\\file.txt" getAbsolutePath="c:\\folder2\\file.txt"

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD