Class ClasspathResourceUtil

java.lang.Object
org.jline.builtins.ClasspathResourceUtil

public class ClasspathResourceUtil extends Object
Utility class for working with classpath resources.

This utility provides methods to convert classpath resources to Path objects, which can be used with JLine's configuration classes like ConfigurationPath.

  • Constructor Details

    • ClasspathResourceUtil

      public ClasspathResourceUtil()
  • Method Details

    • getResourcePath

      public static Path getResourcePath(String name) throws IOException, URISyntaxException
      Converts a classpath resource to a Path.
      Parameters:
      name - The resource name (e.g., "/nano/jnanorc")
      Returns:
      The Path to the resource
      Throws:
      IOException - If an I/O error occurs
      URISyntaxException - If the resource URI is invalid
    • getResourcePath

      public static Path getResourcePath(String name, Class<?> clazz) throws IOException, URISyntaxException
      Converts a classpath resource to a Path.
      Parameters:
      name - The resource name (e.g., "/nano/jnanorc")
      clazz - The class to use for resource loading
      Returns:
      The Path to the resource
      Throws:
      IOException - If an I/O error occurs
      URISyntaxException - If the resource URI is invalid
    • getResourcePath

      public static Path getResourcePath(String name, ClassLoader classLoader) throws IOException, URISyntaxException
      Converts a classpath resource to a Path.
      Parameters:
      name - The resource name (e.g., "/nano/jnanorc")
      classLoader - The ClassLoader to use for resource loading
      Returns:
      The Path to the resource
      Throws:
      IOException - If an I/O error occurs
      URISyntaxException - If the resource URI is invalid
    • getResourcePath

      public static Path getResourcePath(URL resource) throws IOException, URISyntaxException
      Converts a URL to a Path.
      Parameters:
      resource - The URL to convert
      Returns:
      The Path to the resource
      Throws:
      IOException - If an I/O error occurs
      URISyntaxException - If the resource URI is invalid