public class Resources extends Object
| 限定符和类型 | 方法和说明 |
|---|---|
static Class<?> |
classForName(String className)
return the Class of the classname
|
static Charset |
getCharset()
get the Charset
|
static ClassLoader |
getDefaultClassLoader()
get the default classloader
|
static File |
getResourceAsFile(ClassLoader loader,
String resource)
return the File of the resource on the classpath
|
static File |
getResourceAsFile(String resource)
return the File of the resource on the classpath
|
static Properties |
getResourceAsProperties(ClassLoader loader,
String resource)
return the Properties of the resource on the classpath
|
static Properties |
getResourceAsProperties(String resource)
return the Properties of the resource on the classpath
|
static Reader |
getResourceAsReader(ClassLoader loader,
String resource)
return the Reader of the resource on the classpath
|
static Reader |
getResourceAsReader(String resource)
return the Reader of the resource on the classpath
|
static InputStream |
getResourceAsStream(ClassLoader loader,
String resource)
returns the InputStream of the resource on the classpath
|
static InputStream |
getResourceAsStream(String resource)
Returns the InputStream of the resource on the classpath
|
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 List<URL> |
getResourceURLs(ClassLoader loader,
String resource) |
static List<URL> |
getResourceURLs(String resource) |
static Properties |
getUrlAsProperties(String urlString)
return the Properties of url
|
static Reader |
getUrlAsReader(String urlString)
return the Reader of the url
|
static InputStream |
getUrlAsStream(String urlString)
return the InputStream of the url
|
static void |
setCharset(Charset charset)
set the 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 List<URL> getResourceURLs(String resource) throws IOException
IOExceptionpublic static URL getResourceURL(ClassLoader loader, String resource) throws IOException
loader - classloaderresource - The resource to findIOException - If the resource cannot be found or readpublic static List<URL> getResourceURLs(ClassLoader loader, String resource) throws IOException
IOExceptionpublic 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 Classloaderresource - 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 - classloaderresource - 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 - ClassLoaderresource - 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 - ClassLoaderresource - the resource to findIOException - If the resource cannot be found or readpublic static InputStream getUrlAsStream(String urlString) throws IOException
urlString - url stringIOException - If the url cannot be found or readpublic static Reader getUrlAsReader(String urlString) throws IOException
urlString - url StringIOException - If the url cannot be found or readpublic static Properties getUrlAsProperties(String urlString) throws IOException
urlString - url stringIOException - If the url cannot be found or readpublic static Class<?> classForName(String className) throws ClassNotFoundException
className - the classnameClassNotFoundException - If the class cannot be found or readpublic static Charset getCharset()
public static void setCharset(Charset charset)
charset - CharsetCopyright © 2019. All rights reserved.