public class Resources extends Object
Modifier and Type | Method and Description |
---|---|
static Class<?> |
classForName(String className)
Loads a class
|
static Charset |
getCharset() |
static ClassLoader |
getDefaultClassLoader()
Returns the default classloader (may be null).
|
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 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)
Returns a resource on the classpath as a Reader object
|
static Reader |
getResourceAsReader(String resource)
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
|
static Properties |
getUrlAsProperties(String urlString)
Gets a URL as a Properties object
|
static Reader |
getUrlAsReader(String urlString)
Gets a URL as a Reader
|
static InputStream |
getUrlAsStream(String urlString)
Gets a URL as an input stream
|
static void |
setCharset(Charset charset) |
static void |
setDefaultClassLoader(ClassLoader defaultClassLoader)
Sets the default classloader
|
public static ClassLoader getDefaultClassLoader()
public static void setDefaultClassLoader(ClassLoader defaultClassLoader)
defaultClassLoader
- - the new default ClassLoaderpublic 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 fetch 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 fetch 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 fetch the resourceresource
- The resource to findIOException
- If the resource cannot be found or readpublic static Reader getResourceAsReader(String resource) throws IOException
resource
- The resource to findIOException
- If the resource cannot be found or readpublic static Reader getResourceAsReader(ClassLoader loader, String resource) throws IOException
loader
- The classloader used to fetch 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(ClassLoader loader, String resource) throws IOException
loader
- - the classloader used to fetch the resourceresource
- - the resource to findIOException
- If the resource cannot be found or readpublic static InputStream getUrlAsStream(String urlString) throws IOException
urlString
- - the URL to getIOException
- If the resource cannot be found or readpublic static Reader getUrlAsReader(String urlString) throws IOException
urlString
- - the URL to getIOException
- If the resource cannot be found or readpublic static Properties getUrlAsProperties(String urlString) throws IOException
urlString
- - the URL to getIOException
- If the resource cannot be found or readpublic static Class<?> classForName(String className) throws ClassNotFoundException
className
- - the class to fetchClassNotFoundException
- If the class cannot be found (duh!)public static Charset getCharset()
public static void setCharset(Charset charset)
Copyright © 2009–2021 MyBatis.org. All rights reserved.