org.sadun.util
Class PathNormalizer

java.lang.Object
  extended byorg.sadun.util.PathNormalizer

public class PathNormalizer
extends java.lang.Object

An utility class to compute normalized paths (i.e. paths that do not contain neither "." nor "..")

v1.2 supports windows UNC paths (on windows)

Version:
1.2
Author:
C. Sadun (v1.1 patched by Doug.Liao@fnf.com)

Constructor Summary
PathNormalizer()
           
 
Method Summary
static java.io.File normalize(java.io.File path)
          Normalizes a file object.
static java.lang.String normalizePath(java.lang.String path)
          Normalizes a string path.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PathNormalizer

public PathNormalizer()
Method Detail

normalize

public static java.io.File normalize(java.io.File path)
Normalizes a file object. The returned file object will return the normalize path when File.getAbsolutePath() is invoked.

Parameters:
path - the File object to be normalized
Returns:
a File object whose absolute path name is normalized

normalizePath

public static java.lang.String normalizePath(java.lang.String path)
Normalizes a string path. The returned path does not contain ".." or "." references

Parameters:
path - the path to be normalized.
Returns:
a String object containing the normalized path