de.schlichtherle.truezip.io
Class Paths.Normalizer
java.lang.Object
de.schlichtherle.truezip.io.Paths.Normalizer
- Enclosing class:
- Paths
public static class Paths.Normalizer
- extends Object
A normalizer for path names.
|
Method Summary |
private int |
normalize(int collapse,
int end)
This is a recursive call: The top level call should provide
0 as the skip parameter, the length
of the path as the end parameter and an empty string
buffer as the result parameter. |
String |
normalize(String path)
Removes all redundant separators, dot directories (".") and
dot-dot directories ("..") from the given path name and
returns the result. |
private void |
slashify()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
separatorChar
private final char separatorChar
path
private String path
buffer
private final StringBuilder buffer
Paths.Normalizer
public Paths.Normalizer(char separatorChar)
normalize
public String normalize(String path)
- Removes all redundant separators, dot directories (
".") and
dot-dot directories ("..") from the given path name and
returns the result.
If present, a single trailing separator character is retained,
except after a dot-dot directory which couldn't get erased.
A resulting single dot-directory is truncated to an empty path.
On Windows, a path may be prefixed by a drive letter followed by a
colon.
On all platforms, a path may be prefixed by two leading separators
to indicate a UNC, although this is currently only supported on
Windows.
- Parameters:
path - the non-null path name to normalize.
- Returns:
path if it was already in normalized form.
Otherwise, a new string with the normalized form of the
given path name.
normalize
private int normalize(int collapse,
int end)
- This is a recursive call: The top level call should provide
0 as the skip parameter, the length
of the path as the end parameter and an empty string
buffer as the result parameter.
- Parameters:
collapse - the number of adjacent dir/.. segments in
the path to collapse.
This value must not be negative.end - the current position in path.
Only the string to the left of this index is considered.
If not positive, nothing happens.
- Returns:
- The number of adjacent segments in the path which have
not been collapsed at this position.
slashify
private void slashify()
Copyright © 2005-2011 Schlichtherle IT Services. All Rights Reserved.