public class UniformPathUtils extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
SEPARATOR
String representation of
SEPARATOR_CHAR . |
static char |
SEPARATOR_CHAR
The character used as path separator in uniform paths.
|
Constructor and Description |
---|
UniformPathUtils() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
cleanPath(java.lang.String path)
Creates a clean path by resolving duplicate slashes, single and double dots.
|
static java.lang.String |
concatenate(java.lang.String... parts)
Returns the concatenated path of all given parts.
|
static java.lang.String |
createSystemIndependentPath(java.lang.String path)
Remove drive letters or unix root slash from path.
|
static java.lang.String |
extractProject(java.lang.String uniformPath)
Extracts the project part of a uniform path, which is everything up to the
first
SEPARATOR_CHAR . |
static java.lang.String |
getElementName(java.lang.String uniformPath)
Returns the element name for a uniform path, which is the everything starting
from the last
SEPARATOR_CHAR . |
static java.lang.String |
getExtension(java.lang.String uniformPath)
Returns the extension of the uniform path.
|
static java.lang.String |
getParentPath(java.lang.String uniformPath)
Returns the parent path for a path which is everything up to the last
non-escaped
SEPARATOR_CHAR . |
static java.lang.String |
normalizeAllSeparators(java.lang.String path)
Replaces forward and backward slashes, not only system-specific separators,
with a forward slash.
|
static java.lang.String |
prependProject(java.lang.String projectName,
java.lang.String path)
Creates a uniform path by prepending the project to the given path.
|
static java.lang.String |
removeFirstSegments(java.lang.String uniformPath,
int count)
Removes the first
count segments from the given path. |
static java.lang.String |
removeLastSegments(java.lang.String uniformPath,
int count)
Removes the last
count segments from the given path. |
static java.lang.String |
resolveRelativePath(java.lang.String basePath,
java.lang.String relative)
For a uniform path denoting a file and a relative path, constructs the
uniform path for the relatively addressed element.
|
static java.lang.String[] |
splitPath(java.lang.String uniformPath)
Returns segments forming the given path.
|
static java.lang.String |
stripProject(java.lang.String uniformPath)
Returns the path without the project, i.e.
|
public static final char SEPARATOR_CHAR
public static final java.lang.String SEPARATOR
SEPARATOR_CHAR
.public UniformPathUtils()
public static java.lang.String extractProject(java.lang.String uniformPath)
SEPARATOR_CHAR
.public static java.lang.String stripProject(java.lang.String uniformPath)
SEPARATOR_CHAR
.public static java.lang.String getElementName(java.lang.String uniformPath)
SEPARATOR_CHAR
.public static java.lang.String getParentPath(java.lang.String uniformPath)
SEPARATOR_CHAR
. If no separator is found, the empty
string is returned.public static java.lang.String removeFirstSegments(java.lang.String uniformPath, int count)
count
segments from the given path.public static java.lang.String removeLastSegments(java.lang.String uniformPath, int count)
count
segments from the given path.public static java.lang.String[] splitPath(java.lang.String uniformPath)
public static java.lang.String getExtension(java.lang.String uniformPath)
null
, if the path has no extension (i.e. if a path
contains no '.'), returns the empty string if the '.' is the path's
last character.public static java.lang.String normalizeAllSeparators(java.lang.String path)
public static java.lang.String cleanPath(java.lang.String path)
public static java.lang.String resolveRelativePath(java.lang.String basePath, java.lang.String relative)
public static java.lang.String concatenate(java.lang.String... parts)
public static java.lang.String prependProject(java.lang.String projectName, java.lang.String path)
public static java.lang.String createSystemIndependentPath(java.lang.String path)