Class PathTokenizer
java.lang.Object
org.jboss.vfs.util.PathTokenizer
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringapplySpecialPaths(String path) Apply any .applySpecialPaths(List<String> pathTokens) Apply any .static StringgetRemainingPath(List<String> tokens, int i) Get the remaining path from some tokensprotected static StringgetRemainingPath(List<String> tokens, int i, int end) Get the remaining path from some tokensGet the tokens that comprise this path.static voidGet the tokens that comprise this path and append them to the list.static booleanisCurrentToken(String token) Is current token.static booleanisReverseToken(String token) Is reverse token.
-
Field Details
-
CURRENT_PATH
-
REVERSE_PATH
-
STATE_INITIAL
private static final int STATE_INITIALToken states- See Also:
-
STATE_NORMAL
private static final int STATE_NORMAL- See Also:
-
STATE_MAYBE_CURRENT_PATH
private static final int STATE_MAYBE_CURRENT_PATH- See Also:
-
STATE_MAYBE_REVERSE_PATH
private static final int STATE_MAYBE_REVERSE_PATH- See Also:
-
-
Constructor Details
-
PathTokenizer
private PathTokenizer()Utility class
-
-
Method Details
-
getRemainingPath
Get the remaining path from some tokens- Parameters:
tokens- the tokensi- the current locationend- the end index- Returns:
- the remaining path
- Throws:
IllegalArgumentException- for null tokens or i is out of range
-
getTokens
Get the tokens that comprise this path.- Parameters:
path- the path- Returns:
- the tokens or null if the path is empty
- Throws:
IllegalArgumentException- if the path is null
-
getTokens
Get the tokens that comprise this path and append them to the list.- Parameters:
path- the path- Throws:
IllegalArgumentException- if the path is null
-
getRemainingPath
Get the remaining path from some tokens- Parameters:
tokens- the tokensi- the current location- Returns:
- the remaining path
- Throws:
IllegalArgumentException- for null tokens or i is out of range
-
applySpecialPaths
Apply any . or .. paths in the path param.- Parameters:
path- the path- Returns:
- simple path, containing no . or .. paths
- Throws:
IllegalArgumentException
-
applySpecialPaths
public static List<String> applySpecialPaths(List<String> pathTokens) throws IllegalArgumentException Apply any . or .. paths in the pathTokens parameter, returning the minimal token list.- Parameters:
pathTokens- the path tokens- Returns:
- the simple path tokens
- Throws:
IllegalArgumentException- if reverse path goes over the top path
-
isCurrentToken
Is current token.- Parameters:
token- the token to check- Returns:
- true if token matches current path token
-
isReverseToken
Is reverse token.- Parameters:
token- the token to check- Returns:
- true if token matches reverse path token
-