Package org.jline.builtins
Class ClasspathResourceUtil
java.lang.Object
org.jline.builtins.ClasspathResourceUtil
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Path
getResourcePath
(String name) Converts a classpath resource to a Path.static Path
getResourcePath
(String name, Class<?> clazz) Converts a classpath resource to a Path.static Path
getResourcePath
(String name, ClassLoader classLoader) Converts a classpath resource to a Path.static Path
getResourcePath
(URL resource) Converts a URL to a Path.
-
Constructor Details
-
ClasspathResourceUtil
public ClasspathResourceUtil()
-
-
Method Details
-
getResourcePath
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 occursURISyntaxException
- 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 occursURISyntaxException
- 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 occursURISyntaxException
- If the resource URI is invalid
-
getResourcePath
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 occursURISyntaxException
- If the resource URI is invalid
-