public class Resources extends Object
| Modifier | Constructor and Description |
|---|---|
protected |
Resources() |
| Modifier and Type | Method and Description |
|---|---|
static File |
asFile(@NonNull String resourcePath)
Get the specified resource as a local file.
|
static InputStream |
asStream(@NonNull String resourcePath)
Get the specified resource as an input stream.
If it cannot be found (i.e., exists(String) returns false) this method will throw an exception. |
void |
copyDir(String directoryPath,
File destinationDir) |
static void |
copyDirectory(@NonNull String directoryPath,
@NonNull File destinationDir)
Copy the contents of the specified directory (path) to the specified destination directory, resolving any resources in the process
|
static boolean |
exists(@NonNull String resourcePath)
Check if the specified resource exists (can be resolved by any method) hence can be loaded by
asFile(String)
or asStream(String) |
protected File |
getAsFile(String resourcePath) |
InputStream |
getAsStream(String resourcePath) |
String |
normalize(String path) |
static String |
normalizePath(String path)
Normalize the path that may be a resource reference.
|
protected boolean |
resourceExists(String resourcePath) |
public static boolean exists(@NonNull
@NonNull String resourcePath)
asFile(String)
or asStream(String)resourcePath - Path of the resource to be resolvedpublic static File asFile(@NonNull @NonNull String resourcePath)
exists(String) returns false) this method will throw an exception.resourcePath - Path of the resource to getpublic static InputStream asStream(@NonNull @NonNull String resourcePath)
exists(String) returns false) this method will throw an exception.resourcePath - Path of the resource to getpublic static void copyDirectory(@NonNull
@NonNull String directoryPath,
@NonNull
@NonNull File destinationDir)
directoryPath - Directory to copy contents ofdestinationDir - Destinationpublic static String normalizePath(String path)
protected boolean resourceExists(String resourcePath)
public InputStream getAsStream(String resourcePath)
Copyright © 2021. All rights reserved.