public final class PathUtils
extends java.lang.Object
Path
.Modifier and Type | Method and Description |
---|---|
static void |
addRemovePathHook(java.nio.file.Path path)
Adds a hook to the shutdown event of the JVM which will delete all files and directories at
the given path (inclusive) when the JVM exits.
|
static java.nio.file.Path |
createTmpDirToRemoveOnShutdown(java.lang.String prefix) |
static java.nio.file.Path |
createTmpToRemoveOnShutdown(java.lang.String prefix) |
static void |
deleteRecursivelyIfExists(java.nio.file.Path path)
Deletes a file or a directory if it exists.
|
static java.util.List<java.nio.file.Path> |
getClassPathItems(java.lang.String classPath) |
static java.lang.String |
toSystemIndependentPath(java.nio.file.Path path)
Returns a system-independent path.
|
public static void deleteRecursivelyIfExists(@NonNull java.nio.file.Path path) throws java.io.IOException
path
- the file or directory to delete. The file/directory may not exist; if the
directory exists, it may be non-empty.java.io.IOException
@NonNull public static java.lang.String toSystemIndependentPath(@NonNull java.nio.file.Path path)
@NonNull public static java.nio.file.Path createTmpToRemoveOnShutdown(@NonNull java.lang.String prefix) throws java.io.IOException
java.io.IOException
@NonNull public static java.nio.file.Path createTmpDirToRemoveOnShutdown(@NonNull java.lang.String prefix) throws java.io.IOException
java.io.IOException
@NonNull public static java.util.List<java.nio.file.Path> getClassPathItems(@NonNull java.lang.String classPath)
public static void addRemovePathHook(@NonNull java.nio.file.Path path)
path
- the path to delete