@NotThreadSafe public static class Paths.Normalizer extends Object
Constructor and Description |
---|
Normalizer(char separatorChar) |
Modifier and Type | Method and Description |
---|---|
String |
normalize(String path)
Removes all redundant separators, dot directories (
"." ) and
dot-dot directories (".." ) from the given path name and
returns the result. |
public String normalize(String path)
"."
) 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.
path
- the non-null
path name to normalize.path
if it was already in normalized form.
Otherwise, a new string with the normalized form of the
given path name.Copyright © 2005–2018 Schlichtherle IT Services. All rights reserved.