Module id.xfunction
Package id.xfunction

Class ResourceUtils

Object
ResourceUtils

public class ResourceUtils extends Object
  • Constructor Details

    • ResourceUtils

      public ResourceUtils()
  • Method Details

    • readResourceAsStream

      public Stream<String> readResourceAsStream(String absolutePath)
      See Also:
    • readResourceAsList

      public List<String> readResourceAsList(String absolutePath)
      See Also:
    • readResourceAsStream

      public Stream<String> readResourceAsStream(Class<?> clazz, String name)
      See Also:
    • readResourceAsList

      public List<String> readResourceAsList(Class<?> clazz, String name)
      See Also:
    • readResource

      public String readResource(String absolutePath)
      Reads given resource file and returns its content as a string

      If you try to read resource from the module you need to "open" that module to xfunction, otherwise Java will throw NPE.

      Parameters:
      absolutePath - absolute path to the resource in form "xxx/xxx/.../resource"
    • readResource

      public String readResource(Class<?> clazz, String name)
      Reads given resource file and returns its content as a string

      If you try to read resource from the module you need to "open" that module to xfunction, otherwise Java will throw NPE.

      Parameters:
      clazz - class in which package resource is located
      name - resource name
    • extractResource

      public void extractResource(String absoluteResourcePath, Path destination)
      Extracts resource to the following destination. If file does not exist it will be created. If it exist - overwritten.
    • extractResource

      public void extractResource(String absoluteResourcePath, File destination)
      Extracts resource to the following destination. If file does not exist it will be created. If it exist - overwritten.