类 ResourceUtils

java.lang.Object
com.alibaba.nacos.common.utils.ResourceUtils

public class ResourceUtils extends Object
resource util.
作者:
boyan
  • 构造器详细资料

    • ResourceUtils

      public ResourceUtils()
  • 方法详细资料

    • getResourceUrl

      public static URL getResourceUrl(String resource) throws IOException
      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

      public static URL getResourceUrl(ClassLoader loader, String resource) throws IOException
      Returns the URL of the resource on the classpath.
      参数:
      loader - The classloader used to load the resource
      resource - The resource to find
      返回:
      The resource
      抛出:
      IOException - If the resource cannot be found or read
    • getResourceAsStream

      public static InputStream getResourceAsStream(String resource) throws IOException
      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 resource
      resource - The resource to find
      返回:
      The resource
      抛出:
      IOException - If the resource cannot be found or read
    • getResourceAsProperties

      public static Properties getResourceAsProperties(String resource) throws IOException
      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 resource
      resource - 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 resource
      resource - The resource to find
      返回:
      The resource
      抛出:
      IOException - If the resource cannot be found or read
    • getResourceAsFile

      public static File getResourceAsFile(String resource) throws IOException
      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

      public static File getResourceAsFile(URL url)
      Returns a resource on the classpath as a File object.
      参数:
      url - The resource url to find
      返回:
      The resource
    • getResourceAsFile

      public static File getResourceAsFile(ClassLoader loader, String resource) throws IOException
      Returns a resource on the classpath as a File object.
      参数:
      loader - The classloader used to load the resource
      resource - The resource to find
      返回:
      The resource
      抛出:
      IOException - If the resource cannot be found or read