Package org.jibx.util
Class ClasspathUrlExtender
java.lang.Object
org.jibx.util.ClasspathUrlExtender
Support class for accessing resources using classpath URLs. The
buildURL(URL, String) method must be used to
construct a URL for a resource on the classpath, and the setClassLoader(ClassLoader) method must first be
used to set the classloader if it differs from the classloader used for loading this class.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classHandler for opening a connection to a resource from the classpath. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringProtocol name for classpath access.private static ClasspathUrlExtender.ClasspathHandlerSingleton instance of handler for stream access to resource. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic URLConstruct a URL which may represent a resource from the classpath.static booleanisClasspathUrl(String url) Check if a URL string represents a resource from the classpath.static voidsetClassLoader(ClassLoader loader) Set the classloader to be used for accessing resources.
-
Field Details
-
CLASSPATH_PROTOCOL
Protocol name for classpath access.- See Also:
-
s_handler
Singleton instance of handler for stream access to resource.
-
-
Constructor Details
-
ClasspathUrlExtender
public ClasspathUrlExtender()
-
-
Method Details
-
setClassLoader
Set the classloader to be used for accessing resources.- Parameters:
loader-
-
isClasspathUrl
Check if a URL string represents a resource from the classpath.- Parameters:
url-- Returns:
trueif classpath resource,falseif not
-
buildURL
Construct a URL which may represent a resource from the classpath.- Parameters:
base- URL base for relative referencespath- resource path- Returns:
- URL for access to resource
- Throws:
MalformedURLException- if not a valid URL format
-