public final class PathUtils extends Object
Modifier and Type | Method | Description |
---|---|---|
static String |
canonicalize(String path) |
Canonicalize the given path.
|
static <T extends Collection<? super String>> |
filterPaths(Iterable<String> source,
PathFilter filter,
T target) |
Filter the paths from
source into target using filter . |
static Set<String> |
getPathSet(ClassLoader classLoader) |
Attempt to get a set of all paths defined directly by the given class loader.
|
static boolean |
isChild(String parent,
String child) |
Determine whether one path is a child of another.
|
static boolean |
isDirectChild(String parent,
String child) |
Determine whether one path is a direct (or immediate) child of another.
|
static boolean |
isRelative(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 String |
relativize(String path) |
Relativize the given path.
|
public static <T extends Collection<? super String>> T filterPaths(Iterable<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 Set<String> getPathSet(ClassLoader classLoader)
null
is returned.classLoader
- the class loader to inspectnull
if the paths could not be determinedpublic static String relativize(String path)
/
segments from the path.path
- the path to relativizepublic static String canonicalize(String path)
.
and ..
segments from the path.path
- the relative or absolute possibly non-canonical pathpublic static boolean isChild(String parent, String child)
parent
- the parent pathchild
- the child pathtrue
if the child is truly a child of parentpublic static boolean isDirectChild(String parent, String child)
parent
- the parent pathchild
- the child pathtrue
if the child is truly a direct child of parentpublic static boolean isRelative(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 separatorCopyright © 2022 JBoss by Red Hat. All rights reserved.