Package org.jline.builtins
Class ClasspathResourceUtil
- java.lang.Object
-
- org.jline.builtins.ClasspathResourceUtil
-
public class ClasspathResourceUtil extends java.lang.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 Summary
Constructors Constructor Description ClasspathResourceUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.nio.file.Path
getResourcePath(java.lang.String name)
Converts a classpath resource to a Path.static java.nio.file.Path
getResourcePath(java.lang.String name, java.lang.Class<?> clazz)
Converts a classpath resource to a Path.static java.nio.file.Path
getResourcePath(java.lang.String name, java.lang.ClassLoader classLoader)
Converts a classpath resource to a Path.static java.nio.file.Path
getResourcePath(java.net.URL resource)
Converts a URL to a Path.
-
-
-
Method Detail
-
getResourcePath
public static java.nio.file.Path getResourcePath(java.lang.String name) throws java.io.IOException, java.net.URISyntaxException
Converts a classpath resource to a Path.- Parameters:
name
- The resource name (e.g., "/nano/jnanorc")- Returns:
- The Path to the resource
- Throws:
java.io.IOException
- If an I/O error occursjava.net.URISyntaxException
- If the resource URI is invalid
-
getResourcePath
public static java.nio.file.Path getResourcePath(java.lang.String name, java.lang.Class<?> clazz) throws java.io.IOException, java.net.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:
java.io.IOException
- If an I/O error occursjava.net.URISyntaxException
- If the resource URI is invalid
-
getResourcePath
public static java.nio.file.Path getResourcePath(java.lang.String name, java.lang.ClassLoader classLoader) throws java.io.IOException, java.net.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:
java.io.IOException
- If an I/O error occursjava.net.URISyntaxException
- If the resource URI is invalid
-
getResourcePath
public static java.nio.file.Path getResourcePath(java.net.URL resource) throws java.io.IOException, java.net.URISyntaxException
Converts a URL to a Path.- Parameters:
resource
- The URL to convert- Returns:
- The Path to the resource
- Throws:
java.io.IOException
- If an I/O error occursjava.net.URISyntaxException
- If the resource URI is invalid
-
-