类 ResourceUtils
- java.lang.Object
-
- com.alibaba.nacos.common.utils.ResourceUtils
-
public class ResourceUtils extends java.lang.Objectresource util.- 作者:
- boyan
-
-
字段概要
字段 修饰符和类型 字段 说明 private static java.lang.StringCLASSPATH_PREFIX
-
构造器概要
构造器 构造器 说明 ResourceUtils()
-
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static java.io.FilegetResourceAsFile(java.lang.ClassLoader loader, java.lang.String resource)Returns a resource on the classpath as a File object.static java.io.FilegetResourceAsFile(java.lang.String resource)Returns a resource on the classpath as a File object.static java.io.FilegetResourceAsFile(java.net.URL url)Returns a resource on the classpath as a File object.static java.util.PropertiesgetResourceAsProperties(java.lang.ClassLoader loader, java.lang.String resource)Returns a resource on the classpath as a Properties object.static java.util.PropertiesgetResourceAsProperties(java.lang.String resource)Returns a resource on the classpath as a Properties object.static java.io.ReadergetResourceAsReader(java.lang.ClassLoader loader, java.lang.String resource, java.lang.String charsetName)Returns a resource on the classpath as a Reader object.static java.io.InputStreamReadergetResourceAsReader(java.lang.String resource, java.lang.String charsetName)Returns a resource on the classpath as a Reader object.static java.io.InputStreamgetResourceAsStream(java.lang.ClassLoader loader, java.lang.String resource)Returns a resource on the classpath as a Stream object.static java.io.InputStreamgetResourceAsStream(java.lang.String resource)Returns a resource on the classpath as a Stream object.static java.net.URLgetResourceUrl(java.lang.ClassLoader loader, java.lang.String resource)Returns the URL of the resource on the classpath.static java.net.URLgetResourceUrl(java.lang.String resource)Returns the URL of the resource on the classpath.
-
-
-
字段详细资料
-
CLASSPATH_PREFIX
private static final java.lang.String CLASSPATH_PREFIX
- 另请参阅:
- 常量字段值
-
-
方法详细资料
-
getResourceUrl
public static java.net.URL getResourceUrl(java.lang.String resource) throws java.io.IOExceptionReturns the URL of the resource on the classpath.- 参数:
resource- The resource to find- 返回:
- The resource
- 抛出:
java.io.IOException- If the resource cannot be found or read
-
getResourceUrl
public static java.net.URL getResourceUrl(java.lang.ClassLoader loader, java.lang.String resource) throws java.io.IOExceptionReturns the URL of the resource on the classpath.- 参数:
loader- The classloader used to load the resourceresource- The resource to find- 返回:
- The resource
- 抛出:
java.io.IOException- If the resource cannot be found or read
-
getResourceAsStream
public static java.io.InputStream getResourceAsStream(java.lang.String resource) throws java.io.IOExceptionReturns a resource on the classpath as a Stream object.- 参数:
resource- The resource to find- 返回:
- The resource
- 抛出:
java.io.IOException- If the resource cannot be found or read
-
getResourceAsStream
public static java.io.InputStream getResourceAsStream(java.lang.ClassLoader loader, java.lang.String resource) throws java.io.IOExceptionReturns a resource on the classpath as a Stream object.- 参数:
loader- The classloader used to load the resourceresource- The resource to find- 返回:
- The resource
- 抛出:
java.io.IOException- If the resource cannot be found or read
-
getResourceAsProperties
public static java.util.Properties getResourceAsProperties(java.lang.String resource) throws java.io.IOExceptionReturns a resource on the classpath as a Properties object.- 参数:
resource- The resource to find- 返回:
- The resource
- 抛出:
java.io.IOException- If the resource cannot be found or read
-
getResourceAsProperties
public static java.util.Properties getResourceAsProperties(java.lang.ClassLoader loader, java.lang.String resource) throws java.io.IOExceptionReturns a resource on the classpath as a Properties object.- 参数:
loader- The classloader used to load the resourceresource- The resource to find- 返回:
- The resource
- 抛出:
java.io.IOException- If the resource cannot be found or read
-
getResourceAsReader
public static java.io.InputStreamReader getResourceAsReader(java.lang.String resource, java.lang.String charsetName) throws java.io.IOExceptionReturns a resource on the classpath as a Reader object.- 参数:
resource- The resource to find- 返回:
- The resource
- 抛出:
java.io.IOException- If the resource cannot be found or read
-
getResourceAsReader
public static java.io.Reader getResourceAsReader(java.lang.ClassLoader loader, java.lang.String resource, java.lang.String charsetName) throws java.io.IOExceptionReturns a resource on the classpath as a Reader object.- 参数:
loader- The classloader used to load the resourceresource- The resource to find- 返回:
- The resource
- 抛出:
java.io.IOException- If the resource cannot be found or read
-
getResourceAsFile
public static java.io.File getResourceAsFile(java.lang.String resource) throws java.io.IOExceptionReturns a resource on the classpath as a File object.- 参数:
resource- The resource to find- 返回:
- The resource
- 抛出:
java.io.IOException- If the resource cannot be found or read
-
getResourceAsFile
public static java.io.File getResourceAsFile(java.net.URL url)
Returns a resource on the classpath as a File object.- 参数:
url- The resource url to find- 返回:
- The resource
-
getResourceAsFile
public static java.io.File getResourceAsFile(java.lang.ClassLoader loader, java.lang.String resource) throws java.io.IOExceptionReturns a resource on the classpath as a File object.- 参数:
loader- The classloader used to load the resourceresource- The resource to find- 返回:
- The resource
- 抛出:
java.io.IOException- If the resource cannot be found or read
-
-