Skip navigation links

Oracle® WebCenter Content Site Studio for External Applications Java API Reference
11g Release 1 (11.1.1)

E17273-03


oracle.stellent.wcm.common.utils
Class PathHelper

java.lang.Object
  extended by oracle.stellent.wcm.common.utils.PathHelper


public class PathHelper
extends java.lang.Object

Field Summary
static java.lang.String BACKWARD_SLASH_STRING
           
static char CHR_BACK_SLASH
          Character for "\"
static char CHR_DOT
          Character for "."
static char FORWARD_SLASH
           
static java.lang.String FORWARD_SLASH_STRING
           
static java.lang.String QUESTION_MARK_STRING
           

 

Constructor Summary
PathHelper()
           

 

Method Summary
static java.lang.String appendPath(java.lang.String... paths)
           
static java.lang.String concat(java.lang.String s1, java.lang.String s2)
          Fast 2 string concatenation using StringBuffer.
static java.lang.String ensureForwardSlashes(java.lang.String path)
          Changes backward slashes to forward slashes.
static java.lang.String ensureStartingSlash(java.lang.String path)
          Ensure the path starts with a slash
For example: aaa --> /aaa aaa/ --> /aaa/ aaa/bbb/ccc --> /aaa/bbb/ccc /aaa/bbb/ccc --> /aaa/bbb/ccc / --> / null --> null
static java.lang.String ensureTrailingSlash(java.lang.String path)
          Ensure the path ends with a slash
For example: aaa --> aaa/ /aaa --> /aaa/ aaa/bbb/ccc --> /aaa/bbb/ccc/ /aaa/bbb/ccc --> /aaa/bbb/ccc/ / --> / null --> null
static java.lang.String getFirstPathSegment(java.lang.String path)
          Parse first segment out of a path
For example: aaa/bbb/ccc --> aaa /aaa/bbb/ccc --> aaa / --> null null --> null
static java.lang.String getFirstPathSegment(java.lang.String path, char separator)
           
static java.lang.String getLastPathSegment(java.lang.String path)
          Parse last segment out of a path
For example: aaa/bbb/ccc --> ccc aaa/bbb/ccc/ --> ccc / --> null null --> null
static java.lang.String getPathSegment(java.lang.String path, int segment, boolean fromStart)
          Returns the specified path segment.
static java.lang.String justExtension(java.lang.String fullFilePath)
          Returns just the extension from the specified full file path
static java.lang.String justFileName(java.lang.String fullFilePath)
          Returns just file name from the specified full file path
static java.lang.String justFileName(java.lang.String fullFilePath, boolean includeExtension)
          Returns just the file name with or without the extension
static java.lang.String removeStartingQuestionMark(java.lang.String path)
          Remove the beginning question mark from the given path.
static java.lang.String removeStartingSlash(java.lang.String path)
          Remove the beginning slash from the given path.
static java.lang.String removeTrailingSlash(java.lang.String path)
          Remove the ending slash from the given path.
static java.lang.String stripFirstSegment(java.lang.String path)
          Strip first segment out of a path
For example: aaa --> null aaa/ --> null aaa/bbb/ccc --> bbb/ccc aaa/bbb/ccc/ --> /bbb/ccc/ / --> null null --> null
static java.lang.String stripFirstSegment(java.lang.String path, char separator)
           
static java.lang.String stripLastSegment(java.lang.String path)
          Strip last segment out of a path
For example: aaa --> null aaa/ --> null aaa/bbb/ccc --> aaa/bbb/ /aaa/bbb/ccc --> /aaa/bbb/ / --> null null --> null
static java.lang.String stripLastSegment(java.lang.String path, char separator)
           
static java.lang.String stripPath(java.lang.String path)
          Ensure the path does not start or end with slash
For example: aaa --> aaa /aaa --> aaa aaa/bbb/ccc --> aaa/bbb/ccc /aaa/bbb/ccc --> aaa/bbb/ccc / --> null null --> null
static java.lang.String stripPath(java.lang.String path, char separator)
           

 

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

 

Field Detail

CHR_DOT

public static final char CHR_DOT
Character for "."
See Also:
Constant Field Values

CHR_BACK_SLASH

public static final char CHR_BACK_SLASH
Character for "\"
See Also:
Constant Field Values

FORWARD_SLASH_STRING

public static final java.lang.String FORWARD_SLASH_STRING
See Also:
Constant Field Values

BACKWARD_SLASH_STRING

public static final java.lang.String BACKWARD_SLASH_STRING
See Also:
Constant Field Values

QUESTION_MARK_STRING

public static final java.lang.String QUESTION_MARK_STRING
See Also:
Constant Field Values

FORWARD_SLASH

public static final char FORWARD_SLASH
See Also:
Constant Field Values

Constructor Detail

PathHelper

public PathHelper()

Method Detail

getFirstPathSegment

public static java.lang.String getFirstPathSegment(java.lang.String path)
Parse first segment out of a path
For example:

getFirstPathSegment

public static java.lang.String getFirstPathSegment(java.lang.String path,
                                                   char separator)
Parameters:
path -
separator - is the sepataor
See Also:
getFirstPathSegment(java.lang.String)

getLastPathSegment

public static java.lang.String getLastPathSegment(java.lang.String path)
Parse last segment out of a path
For example:

getPathSegment

public static java.lang.String getPathSegment(java.lang.String path,
                                              int segment,
                                              boolean fromStart)
Returns the specified path segment. The first path segment has an index of 0.

stripFirstSegment

public static java.lang.String stripFirstSegment(java.lang.String path)
Strip first segment out of a path
For example:

stripFirstSegment

public static java.lang.String stripFirstSegment(java.lang.String path,
                                                 char separator)
See Also:
stripFirstSegment(java.lang.String)

stripLastSegment

public static java.lang.String stripLastSegment(java.lang.String path)
Strip last segment out of a path
For example:

stripLastSegment

public static java.lang.String stripLastSegment(java.lang.String path,
                                                char separator)
Parameters:
path -
separator - the sepatator of the path
See Also:
stripLastSegment(java.lang.String)

ensureStartingSlash

public static java.lang.String ensureStartingSlash(java.lang.String path)
Ensure the path starts with a slash
For example:

ensureTrailingSlash

public static java.lang.String ensureTrailingSlash(java.lang.String path)
Ensure the path ends with a slash
For example:

stripPath

public static java.lang.String stripPath(java.lang.String path)
Ensure the path does not start or end with slash
For example:

stripPath

public static java.lang.String stripPath(java.lang.String path,
                                         char separator)
Parameters:
path -
separator - is the separator
See Also:
stripPath(java.lang.String)

removeStartingSlash

public static java.lang.String removeStartingSlash(java.lang.String path)
Remove the beginning slash from the given path. If the path does not start with a slash, then the path is returned
Parameters:
path - the path to examine
Returns:
the path without a starting slash

removeStartingQuestionMark

public static java.lang.String removeStartingQuestionMark(java.lang.String path)
Remove the beginning question mark from the given path. If the path does not start with a question mark, then the path is returned
Parameters:
path - the path to examine
Returns:
the path without a starting question mark

removeTrailingSlash

public static java.lang.String removeTrailingSlash(java.lang.String path)
Remove the ending slash from the given path. If the path does not end with a slash, then the path is returned
Parameters:
path - the path to examine
Returns:
the path without a ending slash

ensureForwardSlashes

public static java.lang.String ensureForwardSlashes(java.lang.String path)
Changes backward slashes to forward slashes. This is useful for all functions in this class that check for slashes, they assume forward slash.
Parameters:
path - string to modify
Returns:
all bachward slashed changes to forward

justFileName

public static java.lang.String justFileName(java.lang.String fullFilePath)
Returns just file name from the specified full file path

justFileName

public static java.lang.String justFileName(java.lang.String fullFilePath,
                                            boolean includeExtension)
Returns just the file name with or without the extension
Parameters:
fullFilePath - the full file path
includeExtension - true to include the extension
Returns:
the file name

justExtension

public static java.lang.String justExtension(java.lang.String fullFilePath)
Returns just the extension from the specified full file path

appendPath

public static java.lang.String appendPath(java.lang.String... paths)

concat

public static java.lang.String concat(java.lang.String s1,
                                      java.lang.String s2)
Fast 2 string concatenation using StringBuffer.
Parameters:
s1 - source string #1
s2 - source string #2
Returns:
2 strings concatenated

Skip navigation links

Oracle® WebCenter Content Site Studio for External Applications Java API Reference
11g Release 1 (11.1.1)

E17273-03


Copyright © 2010, 2011, Oracle and/or its affiliates. All rights reserved.