public final class PathUtil extends Object
A series of internal-only path utilities for adjusting relative forms, removing double-slashes, etc. Used in correcting inputs in the creation of new Paths
| Modifier and Type | Method and Description |
|---|---|
static String |
adjustToAbsoluteDirectoryContext(String path)
Adjusts the specified path to absolute form:
|
static String |
adjustToRelativeDirectoryContext(String path)
Adjusts the specified path to relative form:
|
static String |
composeAbsoluteContext(String base,
String context)
Composes an absolute context from a given base and actual context relative to the base, returning the result.
|
static String |
optionallyAppendSlash(String path)
Adds, if not already present, the absolute slash following the specified path, and returns the adjusted result.
|
static String |
optionallyPrependSlash(String path)
Adds, if not already present, the absolute slash preceding the specified path, and returns the adjusted result.
|
static String |
optionallyRemoveFollowingSlash(String path)
Removes, if present, the absolute slash following the specified path, and returns the adjusted result.
|
static String |
optionallyRemovePrecedingSlash(String path)
Removes, if present, the absolute slash preceding the specified path, and returns the adjusted result.
|
public static final String EMPTY
public static String composeAbsoluteContext(String base, String context)
public static String adjustToRelativeDirectoryContext(String path)
1) Removes, if present, a preceding slash 2) Adds, if not present, a trailing slash
Null arguments are returned as-is
path - The path to be adjusted to relative formpublic static String adjustToAbsoluteDirectoryContext(String path)
1) Adds, if not present, a preceding slash 2) Adds, if not present, a trailing slash
Null arguments are returned as-is
path - The path to be adjusted to absolute formpublic static String optionallyRemovePrecedingSlash(String path)
path - The path from which the preceding slash should be removedpublic static String optionallyRemoveFollowingSlash(String path)
path - The path from which the following slash should be removedpublic static String optionallyAppendSlash(String path)
path - The path to which the trailing slash should be addedpublic static String optionallyPrependSlash(String path)
path - The path to which the preceding slash should be addedCopyright © 2024 JBoss by Red Hat. All rights reserved.