|
TrueZIP 6.8.1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.schlichtherle.io.util.Paths
public class Paths
Static utility methods for path names. In order to enhance interoperability, the methods in this class always detect Windows drives ("[a-zA-Z]:") and UNCs ("\\") in a path name, even on non-Windows platforms.
| Constructor Summary | |
|---|---|
protected |
Paths()
You cannot instantiate this class. |
| Method Summary | |
|---|---|
static String |
cutTrailingSeparator(String path,
char separatorChar)
Deprecated. This method chops off a single trailing separator only. Use cutTrailingSeparators(java.lang.String, char) to chop off multiple
trailing separators. |
static String |
cutTrailingSeparators(String path,
char separatorChar)
Cuts off any separator characters at the end of the path, unless the path contains of only separator characters, in which case a single separator character is retained to denote the root directory. |
static String |
normalize(String path)
Equivalent to normalize(path, File.separatorChar). |
static String |
normalize(String path,
char separatorChar)
Removes all redundant separators, dot directories ( ".") and dot-dot directories
("..") from the path and returns the result. |
static String[] |
split(String path)
Equivalent to split(path, File.separatorChar). |
static String[] |
split(String path,
char separatorChar)
Equivalent to split(path, separatorChar, new String[2]). |
static String[] |
split(String path,
char separatorChar,
String[] result)
Splits a path into its parent path and its base name, recognizing platform specific file system roots. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected Paths()
| Method Detail |
|---|
public static String normalize(String path)
normalize(path, File.separatorChar).
public static String normalize(String path,
char separatorChar)
".") and dot-dot directories
("..") from the path and returns the result.
An empty path results in ".".
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 supported on Windows
only.
A single trailing separator character is always retained if present.
path - The name of the path to normalize.separatorChar - The path separator character.
path if it was already in normalized form.
Otherwise, a new String with the normalized form of the given
path.
NullPointerException - If path is null.
public static String cutTrailingSeparators(String path,
char separatorChar)
path if it's a path without trailing separators
or contains the separator only.
Otherwise, the substring until the first of at least one
separating characters is returned.
NullPointerException - If path is null.
public static final String cutTrailingSeparator(String path,
char separatorChar)
cutTrailingSeparators(java.lang.String, char) to chop off multiple
trailing separators.
path if it's a path without a trailing separator
or contains the separator only.
Otherwise, the substring up to the last character is returned.
NullPointerException - If path is null.public static String[] split(String path)
split(path, File.separatorChar).
public static String[] split(String path,
char separatorChar)
split(path, separatorChar, new String[2]).
public static String[] split(String path,
char separatorChar,
String[] result)
path - The name of the path which's parent path and base name
are to be returned.separatorChar - The path separator character to use for this
operation.result - An array of at least two String elements to hold
the result upon return.
null if the
path does not specify a parent. This name compares equal
with File.getParent().File.getName().NullPointerException - If path is null.
|
TrueZIP 6.8.1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||