public class ResourceUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
URL_PROTOCOL_FILE
URL protocol for a file in the file system: "file"
|
| Constructor and Description |
|---|
ResourceUtil() |
| Modifier and Type | Method and Description |
|---|---|
static File |
getFile(URL resourceUrl)
Resolve the given resource URL to a
java.io.File,
i.e. |
static File |
getFile(URL resourceUrl,
String description)
Resolve the given resource URL to a
java.io.File,
i.e. |
static URI |
toURI(String location)
Create a URI instance for the given location String,
replacing spaces with "%20" URI encoding first.
|
static URI |
toURI(URL url)
Create a URI instance for the given URL,
replacing spaces with "%20" URI encoding first.
|
public static final String URL_PROTOCOL_FILE
public static File getFile(URL resourceUrl) throws FileNotFoundException
java.io.File,
i.e. to a file in the file system.resourceUrl - the resource URL to resolveFileNotFoundException - if the URL cannot be resolved to
a file in the file systempublic static File getFile(URL resourceUrl, String description) throws FileNotFoundException
java.io.File,
i.e. to a file in the file system.resourceUrl - the resource URL to resolvedescription - a description of the original resource that
the URL was created for (for example, a class path location)FileNotFoundException - if the URL cannot be resolved to
a file in the file systempublic static URI toURI(URL url) throws URISyntaxException
url - the URL to convert into a URI instanceURISyntaxException - if the URL wasn't a valid URIURL.toURI()public static URI toURI(String location) throws URISyntaxException
location - the location String to convert into a URI instanceURISyntaxException - if the location wasn't a valid URICopyright © 2024. All rights reserved.