com.huguesjohnson
Class PathResolver

java.lang.Object
  extended bycom.huguesjohnson.PathResolver

public abstract class PathResolver
extends java.lang.Object

PathResolver - Utility class to resolve full and absolute paths

Author:
Hugues Johnson

Field Summary
static java.lang.String PARENT_PATH
           
static java.lang.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
See Also:
Constant Field Values

SELF_PATH

public static final java.lang.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" ----