public class ResourceUtils extends Object
| 限定符和类型 | 方法和说明 |
|---|---|
static File |
getResourceAsFile(ClassLoader loader,
String resource)
Returns a resource on the classpath as a File object.
|
static File |
getResourceAsFile(String resource)
Returns a resource on the classpath as a File object.
|
static File |
getResourceAsFile(URL url)
Returns a resource on the classpath as a File object.
|
static Properties |
getResourceAsProperties(ClassLoader loader,
String resource)
Returns a resource on the classpath as a Properties object.
|
static Properties |
getResourceAsProperties(String resource)
Returns a resource on the classpath as a Properties object.
|
static Reader |
getResourceAsReader(ClassLoader loader,
String resource,
String charsetName)
Returns a resource on the classpath as a Reader object.
|
static InputStreamReader |
getResourceAsReader(String resource,
String charsetName)
Returns a resource on the classpath as a Reader object.
|
static InputStream |
getResourceAsStream(ClassLoader loader,
String resource)
Returns a resource on the classpath as a Stream object.
|
static InputStream |
getResourceAsStream(String resource)
Returns a resource on the classpath as a Stream object.
|
static URL |
getResourceUrl(ClassLoader loader,
String resource)
Returns the URL of the resource on the classpath.
|
static URL |
getResourceUrl(String resource)
Returns the URL of the resource on the classpath.
|
public static URL getResourceUrl(String resource) throws IOException
resource - The resource to findIOException - If the resource cannot be found or readpublic static URL getResourceUrl(ClassLoader loader, String resource) throws IOException
loader - The classloader used to load the resourceresource - The resource to findIOException - If the resource cannot be found or readpublic static InputStream getResourceAsStream(String resource) throws IOException
resource - The resource to findIOException - If the resource cannot be found or readpublic static InputStream getResourceAsStream(ClassLoader loader, String resource) throws IOException
loader - The classloader used to load the resourceresource - The resource to findIOException - If the resource cannot be found or readpublic static Properties getResourceAsProperties(String resource) throws IOException
resource - The resource to findIOException - If the resource cannot be found or readpublic static Properties getResourceAsProperties(ClassLoader loader, String resource) throws IOException
loader - The classloader used to load the resourceresource - The resource to findIOException - If the resource cannot be found or readpublic static InputStreamReader getResourceAsReader(String resource, String charsetName) throws IOException
resource - The resource to findIOException - If the resource cannot be found or readpublic static Reader getResourceAsReader(ClassLoader loader, String resource, String charsetName) throws IOException
loader - The classloader used to load the resourceresource - The resource to findIOException - If the resource cannot be found or readpublic static File getResourceAsFile(String resource) throws IOException
resource - The resource to findIOException - If the resource cannot be found or readpublic static File getResourceAsFile(URL url)
url - The resource url to findpublic static File getResourceAsFile(ClassLoader loader, String resource) throws IOException
loader - The classloader used to load the resourceresource - The resource to findIOException - If the resource cannot be found or readCopyright © 2018–2024 Alibaba Group. All rights reserved.