EAC Toolkit 3.2.1

com.endeca.soleng.eac.toolkit.utils
Class PathUtils

java.lang.Object
  extended by com.endeca.soleng.eac.toolkit.utils.PathUtils

public class PathUtils
extends java.lang.Object

This class exposes static utility methods for manipulating, parsing and interpreting paths.

Author:
sshusteff

Constructor Summary
PathUtils()
           
 
Method Summary
static java.lang.String getAbsolutePath(java.lang.String workingDir, java.lang.String path)
          Returns a string representation of the specified path, resolved against the working directory, if it isn't absolute.
static java.lang.String getFileNameFromPath(java.lang.String path)
          Strips the directory path from a file or dir name, returning just the trailing prefix/filename from a path.
static boolean isAbsolute(java.lang.String path)
          Returns true if the specified path is absolute.
static java.lang.String[] splitRootFromAbsolutePath(java.lang.String path)
          Splits an absolute path into an absolute root directory and a path relative to that root directory.
static java.lang.String stripFilenameFromPath(java.lang.String path)
          Removes the trailing prefix/filename from a path, returning just the directory path.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PathUtils

public PathUtils()
Method Detail

getAbsolutePath

public static java.lang.String getAbsolutePath(java.lang.String workingDir,
                                               java.lang.String path)
Returns a string representation of the specified path, resolved against the working directory, if it isn't absolute. If the path is relative and the working dir is null, this method will return the unresolved relative path. Note that this is different from the EAC's behavior of defaulting to a working dir relative to the ENDECA_CONF environment variable.

Parameters:
workingDir - Working dir specified for the component.
path - The path to resolve.
Returns:
Returns the resolved, absolute path.

stripFilenameFromPath

public static java.lang.String stripFilenameFromPath(java.lang.String path)
Removes the trailing prefix/filename from a path, returning just the directory path.

Parameters:
path - Path whose trailing filename will be removed.
Returns:
Returns the path with the trailing filename removed.

getFileNameFromPath

public static java.lang.String getFileNameFromPath(java.lang.String path)
Strips the directory path from a file or dir name, returning just the trailing prefix/filename from a path.

Parameters:
path - Path from which to retrieve the filename.
Returns:
Returns the filename with the directory path removed.

isAbsolute

public static boolean isAbsolute(java.lang.String path)
Returns true if the specified path is absolute.

Parameters:
path - Path to test.
Returns:
Returns true if the path is absolute.

splitRootFromAbsolutePath

public static java.lang.String[] splitRootFromAbsolutePath(java.lang.String path)
Splits an absolute path into an absolute root directory and a path relative to that root directory. The return value is a String array containing 2 values: working dir and relative path, in that order. If the path is not absolute, the working directory is returned as null and the path is returned as the relative path. The working dir is extracted as the

Parameters:
path - Path to split.
Returns:
Returns a string array containing two strings. The first string in the array represents the absolute root path (or null, if the path is relative or not in a known absolute format). The second string in the array represents the relative path to the root dir.

EAC Toolkit 3.2.1

Copyright © 2011 Endeca Technologies, Inc. All Rights Reserved.
@VERSION
PRODUCT: EAC Toolkit (eacToolkit)
VERSION: 3.2.1
BUILD:   NONE
ARCH_OS: n/a
DATE:    2011-11-10T16:21:05-0500