public class ResourcesUtils extends Object
| 构造器和说明 |
|---|
ResourcesUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static Class<?> |
classForName(ClassLoader loader,
String className)
Loads a class
|
static Class<?> |
classForName(String className)
Loads a class
|
static String |
formatResource(String resourcePath) |
static Map<String,String> |
getProperty(ClassLoader classLoader,
String resourcePath)
读取一个属性文件,并且以
Map接口的形式返回。 |
static Map<String,String> |
getProperty(Iterator<String> iterator)
合成所有属性文件的配置信息到一个
Map接口中。 |
static Map<String,String> |
getProperty(String resourcePath)
读取一个属性文件,并且以
Map接口的形式返回。 |
static Map<String,String> |
getProperty(String[] resourcePaths)
合成所有属性文件的配置信息到一个
Map接口中。 |
static URL |
getResource(ClassLoader classLoader,
String resourcePath)
获取 classpath 中可能存在的资源。
|
static URL |
getResource(String resourcePath)
获取 classpath 中可能存在的资源。
|
static InputStream |
getResourceAsStream(ClassLoader classLoader,
String resourcePath)
获取classpath中可能存在的资源,以流的形式返回。
|
static InputStream |
getResourceAsStream(ClassLoader classLoader,
URI resourceURI)
获取classpath中可能存在的资源,以流的形式返回。
|
static InputStream |
getResourceAsStream(ClassLoader classLoader,
URL resourceURL)
获取classpath中可能存在的资源,以流的形式返回。
|
static InputStream |
getResourceAsStream(File resourceFile)
获取可能存在的资源,以流的形式返回。
|
static InputStream |
getResourceAsStream(String resourcePath)
获取classpath中可能存在的资源,以流的形式返回。
|
static InputStream |
getResourceAsStream(URI resourceURI)
获取classpath中可能存在的资源,以流的形式返回。
|
static InputStream |
getResourceAsStream(URL resourceURL)
获取classpath中可能存在的资源,以流的形式返回。
|
static List<InputStream> |
getResourceAsStreamList(ClassLoader classLoader,
String resourcePath)
获取classpath中可能存在的资源列表,以流的形式返回。
|
static List<InputStream> |
getResourceAsStreamList(String resourcePath)
获取classpath中可能存在的资源列表,以流的形式返回。
|
static List<URL> |
getResources(ClassLoader classLoader,
String resourcePath)
获取 classpath 中可能存在的资源列表。
|
static List<URL> |
getResources(String resourcePath)
获取 classpath 中可能存在的资源列表。
|
public static Map<String,String> getProperty(String[] resourcePaths) throws IOException
Map接口中。IOExceptionpublic static Map<String,String> getProperty(Iterator<String> iterator) throws IOException
Map接口中。IOExceptionpublic static Map<String,String> getProperty(String resourcePath) throws IOException
Map接口的形式返回。IOExceptionpublic static Map<String,String> getProperty(ClassLoader classLoader, String resourcePath) throws IOException
Map接口的形式返回。IOExceptionpublic static URL getResource(String resourcePath) throws IOException
IOExceptionpublic static URL getResource(ClassLoader classLoader, String resourcePath) throws IOException
IOExceptionpublic static List<URL> getResources(String resourcePath) throws IOException
IOExceptionpublic static List<URL> getResources(ClassLoader classLoader, String resourcePath) throws IOException
IOExceptionpublic static InputStream getResourceAsStream(File resourceFile) throws IOException
IOExceptionpublic static InputStream getResourceAsStream(URI resourceURI) throws IOException
IOExceptionpublic static InputStream getResourceAsStream(String resourcePath) throws IOException
IOExceptionpublic static InputStream getResourceAsStream(URL resourceURL) throws IOException
IOExceptionpublic static InputStream getResourceAsStream(ClassLoader classLoader, URI resourceURI) throws IOException
IOExceptionpublic static InputStream getResourceAsStream(ClassLoader classLoader, String resourcePath) throws IOException
IOExceptionpublic static InputStream getResourceAsStream(ClassLoader classLoader, URL resourceURL) throws IOException
IOExceptionpublic static List<InputStream> getResourceAsStreamList(String resourcePath) throws IOException
IOExceptionpublic static List<InputStream> getResourceAsStreamList(ClassLoader classLoader, String resourcePath) throws IOException
IOExceptionpublic static Class<?> classForName(String className) throws ClassNotFoundException
className - - the class to fetchClassNotFoundException - If the class cannot be found (duh!)public static Class<?> classForName(ClassLoader loader, String className) throws ClassNotFoundException
className - - the class to fetchClassNotFoundException - If the class cannot be found (duh!)Copyright © 2022–2023. All rights reserved.