public final class PathUtils
extends java.lang.Object
Modifier and Type | Method | Description |
---|---|---|
static java.lang.String |
basicModuleNameToPath(java.lang.String moduleName) |
Convert a "basic" module name to a relative path specification.
|
static java.lang.String |
canonicalize(java.lang.String path) |
Canonicalize the given path.
|
static java.lang.String |
fileNameOfPath(java.lang.String path) |
Get the file name (last) segment of the given path.
|
static <T extends java.util.Collection<? super java.lang.String>> |
filterPaths(java.lang.Iterable<java.lang.String> source,
PathFilter filter,
T target) |
Filter the paths from
source into target using filter . |
static java.util.Set<java.lang.String> |
getPathSet(java.lang.ClassLoader classLoader) |
Attempt to get a set of all paths defined directly by the given class loader.
|
static boolean |
isChild(java.lang.String parent,
java.lang.String child) |
Determine whether one path is a child of another.
|
static boolean |
isDirectChild(java.lang.String parent,
java.lang.String child) |
Determine whether one path is a direct (or immediate) child of another.
|
static boolean |
isRelative(java.lang.String path) |
Determine whether a path name is relative.
|
static boolean |
isSeparator(char ch) |
Determine whether the given character is a
/ or a platform-specific separator. |
static java.lang.String |
relativize(java.lang.String path) |
Relativize the given path.
|
static java.lang.String |
toGenericSeparators(java.lang.String original) |
Get the given path name with OS-specific separators replaced with the generic
/ separator character. |
public static <T extends java.util.Collection<? super java.lang.String>> T filterPaths(java.lang.Iterable<java.lang.String> source, PathFilter filter, T target)
source
into target
using filter
.T
- the collection typesource
- the source pathsfilter
- the filter to applytarget
- the destination for filtered pathstarget
setpublic static java.util.Set<java.lang.String> getPathSet(java.lang.ClassLoader classLoader)
null
is returned.classLoader
- the class loader to inspectnull
if the paths could not be determinedpublic static java.lang.String relativize(java.lang.String path)
/
segments from the path.path
- the path to relativizepublic static java.lang.String fileNameOfPath(java.lang.String path)
path
- the path namepublic static java.lang.String canonicalize(java.lang.String path)
.
and ..
segments from the path.path
- the relative or absolute possibly non-canonical pathpublic static boolean isChild(java.lang.String parent, java.lang.String child)
parent
- the parent pathchild
- the child pathtrue
if the child is truly a child of parentpublic static boolean isDirectChild(java.lang.String parent, java.lang.String child)
parent
- the parent pathchild
- the child pathtrue
if the child is truly a direct child of parentpublic static java.lang.String toGenericSeparators(java.lang.String original)
/
separator character.original
- the original string/
public static boolean isRelative(java.lang.String path)
path
- the path nametrue
if it is relativepublic static boolean isSeparator(char ch)
/
or a platform-specific separator.ch
- the character to testtrue
if it is a separatorpublic static java.lang.String basicModuleNameToPath(java.lang.String moduleName)
moduleName
- the basic module namenull
if the name is not validCopyright © 2022 JBoss by Red Hat. All rights reserved.