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

## oracle.ifs.common
Class PathHelper

    java.lang.Object
      oracle.ifs.common.PathHelper

    public class PathHelper

extends java.lang.Object

PathHelper is a class use to provide utility methods for paths. This is specific to paths as defined by 9iFS. It does not deal with paths that contain drive letters and they have no meaning to 9iFS.

General path rules

- path delimeter is determined from the session at the time of the call.
- a path must not contain a ..
- a path must not contain a .
- a path to a folder may end with a path delimiter
- a path to a non folder may not end with path delimiter
- the root node is specified by a single path delimiter(e.g "/")
- on methods that take a Folder and a path relative to that folder the path must not start with a path delimeter
- on methods that take a path based upon a implementation determined root folder the path must start with a path delimeter.

  (Unpublished)

  Field Summary
  `static java.lang.String` | `m_DefaultDelimiter`

  Constructor Summary
  `PathHelper()`

  Method Summary
  `static boolean` | `containsOnlyValidCharacters(java.lang.String path)` Check to see if an path contains only valid characters.
  `static java.lang.String` | `getBaseName(java.lang.String path, java.lang.String delimiter)` Given a String which specifies a path return the name of the file or folder denoted by the path.
  `static java.lang.String` | `getNormalizedPath(java.lang.String path, java.lang.String delimiter)` Given a path remove all relative path references and multiple path delimiters returning a path based upon a base folder.
  `static java.lang.String` | `getParentPath(java.lang.String path, java.lang.String delimiter)` Returns the parent part of the pathname of the path provided.
  `static boolean` | `isAbsolutePath(java.lang.String path, java.lang.String delimiter)` Given a String which specifies a path check to see if the path starts with folder path delimiter.
  `static java.lang.String` | `removeTrailingDelimiter(java.lang.String path, java.lang.String delimiter)` Given a String which specifies a path check to see if the path end with folder path delimiter and return a string with it removed
  `static java.lang.String` | `resolveUpDirectoryRefs(java.lang.String path, java.lang.String delimiter)` Given a String which specifies a path resolve upDirectory, and currentDirectory references, and remove extra path delimiters.
  `static boolean` | `verifyPath(java.lang.String path, boolean relativePath, java.lang.String delimiter)` Given a String which specifies a path validate that is is a valid path.
  `protected static boolean` | `verifyPath(java.lang.String path, java.lang.String delim)` Given a String which specifies a path validate that is is a valid path.

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

  Field Detail

  ### m_DefaultDelimiter

      public static final java.lang.String m_DefaultDelimiter

  See Also:
    Constant Field Values

  Constructor Detail

  ### PathHelper

      public PathHelper()

  Method Detail

  ### getNormalizedPath

      public static java.lang.String getNormalizedPath(java.lang.String path,
                                                       java.lang.String delimiter)
                                                throws IfsException

    Description copied from class: `PathHelper`
    Given a path remove all relative path references and multiple path delimiters returning a path based upon a base folder. Paths seperator characters will be converted to the seperator charactor of the library session passed in. Relative paths are supported. A check to made to insure the path contains only legal characters.

    Parameters:
      `path` - the String which specifies the path to normailize.
      `delimiter` - the file system delimiter to use, if null a default delimiter of "/" is used.
    Returns:
      a String containing the normailzed path
    Throws:
      `IfsException` - (IFS-32615) path is invalid or IfsException (IFS-19001-0-30) no path specified
    (Unpublished)

  ### getParentPath

      public static java.lang.String getParentPath(java.lang.String path,
                                                   java.lang.String delimiter)
                                            throws IfsException

    Description copied from class: `PathHelper`
    Returns the parent part of the pathname of the path provided. The parent part is generally everything leading up to the last occurrence of the separator character, although the precise definition is system dependent. A null object is returned when there is no parent.

    Examples with / being the seperator character:

    - "/abc/def/ghi" returns "/abc/def"
    - "/abc/def/ghi/" returns "/abc/def"
    - "/abc" returns "/"
    - "/" returns null
    - "abc" returns null

    Parameters:
      `path` - the String which specifies the path to parse and get the parent.
      `delimiter` - the file system delimiter to use, if null a default delimiter of "/" is used.
    Returns:
      a String representing the path to Parent Folder, or null if no parent.
    Throws:
      `IfsException` - (IFS-44003) no path specified
    (Unpublished)

  ### getBaseName

      public static java.lang.String getBaseName(java.lang.String path,
                                                 java.lang.String delimiter)
                                          throws IfsException

    Description copied from class: `PathHelper`
    Given a String which specifies a path return the name of the file or folder denoted by the path. This is just the last name in the pathname's name sequence. If the pathname's name sequence is empty, then the empty string is returned.

    Examples with / being the seperator character:

    - "/abc/def/ghi" returns "ghi"
    - "/abc/def/ghi/" returns "ghi"
    - "/abc" returns "abc"
    - "/" returns ""
    - "abc" returns "abc"

    Parameters:
      `path` - The String which specifies the path to get the name from.
      `delimiter` - the file system delimiter to use, if null a default delimiter of "/" is used.
    Returns:
      The name of the file or directory denoted by this abstract pathname, or the empty string if this pathname's name sequence is empty
    Throws:
      `IfsException` - (IFS-32615) path is invalid or IfsException (IFS-44003) no path specified
    (Unpublished)

  ### verifyPath

      public static boolean verifyPath(java.lang.String path,
                                       boolean relativePath,
                                       java.lang.String delimiter)
                                throws IfsException

    Description copied from class: `PathHelper`
    Given a String which specifies a path validate that is is a valid path. Valid does not mean that an object exists at the specified path, but that the path is syntacitally correct.

    Examples of invalid paths:

    - "../abc"
    - "/abc" for a relative path
    - "abc" for an absolute path
    - "ab*c" invalid chars are {'*', '?', '"', '<', '>', '|'};

    Parameters:
      `path` - The String which specifies the path to validate
      `relativePath` - a boolean which specifies if the path is a relative or not true = relative, false absolute
      `delimiter` - the file system delimiter to use, if null a default delimiter of "/" is used.
    Returns:
      a boolean, true is valid, false invalid
    Throws:
      `IfsException` - (IFS-44003) no path specified
    (Unpublished)

  ### verifyPath

      protected static boolean verifyPath(java.lang.String path,
                                          java.lang.String delim)
                                   throws IfsException

    Description copied from class: `PathHelper`
    Given a String which specifies a path validate that is is a valid path. Valid does not mean that an object exists at the specified path, but that the path is syntacitally correct. This only check for illegal characters or invalid updirectories. It does not check for differences absolute and relative paths, use verifyPath(String, boolean, LibrarySession)

    Examples of invalid paths:

    - "../abc"
    - "ab*c" invalid chars are {'*', '?', '"', '<', '>', '|'};

    Parameters:
      `path` - The String which specifies the path to validate
      `delim` - the file system delimiter to use, if null a default delimiter of "/" is used.
    Returns:
      a boolean, true is valid, false invalid
    Throws:
      `IfsException` - (IFS-44003) no path specified
    (Unpublished)

  ### containsOnlyValidCharacters

      public static boolean containsOnlyValidCharacters(java.lang.String path)
                                                 throws IfsException

    Description copied from class: `PathHelper`
    Check to see if an path contains only valid characters.

    Parameters:
      `path` - the String containing the path to check
    Returns:
      boolean true if path is valid, false invalid
    Throws:
      `IfsException`
    (Unpublished)

  ### resolveUpDirectoryRefs

      public static java.lang.String resolveUpDirectoryRefs(java.lang.String path,
                                                            java.lang.String delimiter)
                                                     throws IfsException

    Description copied from class: `PathHelper`
    Given a String which specifies a path resolve upDirectory, and currentDirectory references, and remove extra path delimiters.

    Examples of resolved paths:

    - "a/b//c/../" becomes "a/b"
    - "a/./b/../c" becomes "a/c";

    Parameters:
      `path` - The String which specifies the path to resolve updirectories on
      `delimiter` - the file system delimiter to use, if null a default delimiter of "/" is used.
    Returns:
      a String with the updirectories removed
    Throws:
      `IfsException` - (IFS-32615) path is invalid or IfsException (IFS-44003) no path specified
    (Unpublished)

  ### isAbsolutePath

      public static boolean isAbsolutePath(java.lang.String path,
                                           java.lang.String delimiter)
                                    throws IfsException

    Description copied from class: `PathHelper`
    Given a String which specifies a path check to see if the path starts with folder path delimiter.

    Parameters:
      `path` - The String which specifies the path to check
      `delimiter` - the file system delimiter to use, if null a default delimiter of "/" is used.
    Returns:
      a boolean which indicates if the path is absolute, true = absolute, false = relative
    Throws:
      `IfsException` - (IFS-32615) path is invalid or IfsException (IFS-44003) no path specified
    (Unpublished)

  ### removeTrailingDelimiter

      public static java.lang.String removeTrailingDelimiter(java.lang.String path,
                                                             java.lang.String delimiter)

    Description copied from class: `PathHelper`
    Given a String which specifies a path check to see if the path end with folder path delimiter and return a string with it removed

    Parameters:
      `path` - The String which specifies the path to check
      `delimiter` - the file system delimiter to use, if null a default delimiter of "/" is used.
    Returns:
      a boolean which indicates if the path is absolute, true = absolute, false = relative
    Throws:
      `IfsException` - (IFS-32615) path is invalid or IfsException (IFS-44003) no path specified
    (Unpublished)

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