类 ResourceUtils
java.lang.Object
com.alibaba.nacos.common.utils.ResourceUtils
resource util.
- 作者:
- boyan
-
方法概要
修饰符和类型方法说明static FilegetResourceAsFile(ClassLoader loader, String resource) Returns a resource on the classpath as a File object.static FilegetResourceAsFile(String resource) Returns a resource on the classpath as a File object.static FilegetResourceAsFile(URL url) Returns a resource on the classpath as a File object.static PropertiesgetResourceAsProperties(ClassLoader loader, String resource) Returns a resource on the classpath as a Properties object.static PropertiesgetResourceAsProperties(String resource) Returns a resource on the classpath as a Properties object.static ReadergetResourceAsReader(ClassLoader loader, String resource, String charsetName) Returns a resource on the classpath as a Reader object.static InputStreamReadergetResourceAsReader(String resource, String charsetName) Returns a resource on the classpath as a Reader object.static InputStreamgetResourceAsStream(ClassLoader loader, String resource) Returns a resource on the classpath as a Stream object.static InputStreamgetResourceAsStream(String resource) Returns a resource on the classpath as a Stream object.static URLgetResourceUrl(ClassLoader loader, String resource) Returns the URL of the resource on the classpath.static URLgetResourceUrl(String resource) Returns the URL of the resource on the classpath.
-
方法详细资料
-
getResourceUrl
Returns the URL of the resource on the classpath.- 参数:
resource- The resource to find- 返回:
- The resource
- 抛出:
IOException- If the resource cannot be found or read
-
getResourceUrl
Returns the URL of the resource on the classpath.- 参数:
loader- The classloader used to load the resourceresource- The resource to find- 返回:
- The resource
- 抛出:
IOException- If the resource cannot be found or read
-
getResourceAsStream
Returns a resource on the classpath as a Stream object.- 参数:
resource- The resource to find- 返回:
- The resource
- 抛出:
IOException- If the resource cannot be found or read
-
getResourceAsStream
public static InputStream getResourceAsStream(ClassLoader loader, String resource) throws IOException Returns a resource on the classpath as a Stream object.- 参数:
loader- The classloader used to load the resourceresource- The resource to find- 返回:
- The resource
- 抛出:
IOException- If the resource cannot be found or read
-
getResourceAsProperties
Returns a resource on the classpath as a Properties object.- 参数:
resource- The resource to find- 返回:
- The resource
- 抛出:
IOException- If the resource cannot be found or read
-
getResourceAsProperties
public static Properties getResourceAsProperties(ClassLoader loader, String resource) throws IOException Returns a resource on the classpath as a Properties object.- 参数:
loader- The classloader used to load the resourceresource- The resource to find- 返回:
- The resource
- 抛出:
IOException- If the resource cannot be found or read
-
getResourceAsReader
public static InputStreamReader getResourceAsReader(String resource, String charsetName) throws IOException Returns a resource on the classpath as a Reader object.- 参数:
resource- The resource to find- 返回:
- The resource
- 抛出:
IOException- If the resource cannot be found or read
-
getResourceAsReader
public static Reader getResourceAsReader(ClassLoader loader, String resource, String charsetName) throws IOException Returns a resource on the classpath as a Reader object.- 参数:
loader- The classloader used to load the resourceresource- The resource to find- 返回:
- The resource
- 抛出:
IOException- If the resource cannot be found or read
-
getResourceAsFile
Returns a resource on the classpath as a File object.- 参数:
resource- The resource to find- 返回:
- The resource
- 抛出:
IOException- If the resource cannot be found or read
-
getResourceAsFile
Returns a resource on the classpath as a File object.- 参数:
url- The resource url to find- 返回:
- The resource
-
getResourceAsFile
Returns a resource on the classpath as a File object.- 参数:
loader- The classloader used to load the resourceresource- The resource to find- 返回:
- The resource
- 抛出:
IOException- If the resource cannot be found or read
-