Package org.jboss.vfs.util
Class PathTokenizer
- java.lang.Object
-
- org.jboss.vfs.util.PathTokenizer
-
public class PathTokenizer extends java.lang.ObjectPathTokenizer.- Version:
- $Revision: 1.1 $
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringCURRENT_PATHThe reverse path constprivate static java.lang.StringREVERSE_PATHThe reverse path constprivate static intSTATE_INITIALToken statesprivate static intSTATE_MAYBE_CURRENT_PATHprivate static intSTATE_MAYBE_REVERSE_PATHprivate static intSTATE_NORMAL
-
Constructor Summary
Constructors Modifier Constructor Description privatePathTokenizer()Utility class
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringapplySpecialPaths(java.lang.String path)Apply any .static java.util.List<java.lang.String>applySpecialPaths(java.util.List<java.lang.String> pathTokens)Apply any .static java.lang.StringgetRemainingPath(java.util.List<java.lang.String> tokens, int i)Get the remaining path from some tokensprotected static java.lang.StringgetRemainingPath(java.util.List<java.lang.String> tokens, int i, int end)Get the remaining path from some tokensstatic java.util.List<java.lang.String>getTokens(java.lang.String path)Get the tokens that comprise this path.static voidgetTokens(java.util.List<java.lang.String> list, java.lang.String path)Get the tokens that comprise this path and append them to the list.static booleanisCurrentToken(java.lang.String token)Is current token.static booleanisReverseToken(java.lang.String token)Is reverse token.
-
-
-
Field Detail
-
CURRENT_PATH
private static final java.lang.String CURRENT_PATH
The reverse path const- See Also:
- Constant Field Values
-
REVERSE_PATH
private static final java.lang.String REVERSE_PATH
The reverse path const- See Also:
- Constant Field Values
-
STATE_INITIAL
private static final int STATE_INITIAL
Token states- See Also:
- Constant Field Values
-
STATE_NORMAL
private static final int STATE_NORMAL
- See Also:
- Constant Field Values
-
STATE_MAYBE_CURRENT_PATH
private static final int STATE_MAYBE_CURRENT_PATH
- See Also:
- Constant Field Values
-
STATE_MAYBE_REVERSE_PATH
private static final int STATE_MAYBE_REVERSE_PATH
- See Also:
- Constant Field Values
-
-
Method Detail
-
getRemainingPath
protected static java.lang.String getRemainingPath(java.util.List<java.lang.String> tokens, int i, int end)Get the remaining path from some tokens- Parameters:
tokens- the tokensi- the current locationend- the end index- Returns:
- the remaining path
- Throws:
java.lang.IllegalArgumentException- for null tokens or i is out of range
-
getTokens
public static java.util.List<java.lang.String> getTokens(java.lang.String path)
Get the tokens that comprise this path.- Parameters:
path- the path- Returns:
- the tokens or null if the path is empty
- Throws:
java.lang.IllegalArgumentException- if the path is null
-
getTokens
public static void getTokens(java.util.List<java.lang.String> list, java.lang.String path)Get the tokens that comprise this path and append them to the list.- Parameters:
path- the path- Throws:
java.lang.IllegalArgumentException- if the path is null
-
getRemainingPath
public static java.lang.String getRemainingPath(java.util.List<java.lang.String> tokens, int i)Get the remaining path from some tokens- Parameters:
tokens- the tokensi- the current location- Returns:
- the remaining path
- Throws:
java.lang.IllegalArgumentException- for null tokens or i is out of range
-
applySpecialPaths
public static java.lang.String applySpecialPaths(java.lang.String path) throws java.lang.IllegalArgumentExceptionApply any . or .. paths in the path param.- Parameters:
path- the path- Returns:
- simple path, containing no . or .. paths
- Throws:
java.lang.IllegalArgumentException
-
applySpecialPaths
public static java.util.List<java.lang.String> applySpecialPaths(java.util.List<java.lang.String> pathTokens) throws java.lang.IllegalArgumentExceptionApply any . or .. paths in the pathTokens parameter, returning the minimal token list.- Parameters:
pathTokens- the path tokens- Returns:
- the simple path tokens
- Throws:
java.lang.IllegalArgumentException- if reverse path goes over the top path
-
isCurrentToken
public static boolean isCurrentToken(java.lang.String token)
Is current token.- Parameters:
token- the token to check- Returns:
- true if token matches current path token
-
isReverseToken
public static boolean isReverseToken(java.lang.String token)
Is reverse token.- Parameters:
token- the token to check- Returns:
- true if token matches reverse path token
-
-