Package gnu.text
Class ResourceStreamHandler
- java.lang.Object
-
- java.net.URLStreamHandler
-
- gnu.text.ResourceStreamHandler
-
public class ResourceStreamHandler extends java.net.URLStreamHandlerHandler for"class-resource:"URLs. These are "indirect URLs" implemented using ClassLoader.getResource(). Their syntax is: either:class-resource:/PACKAGE/CLASSorclass-resource:/CLASSorclass-resource:/PACKAGE/RESOURCEorclass-resource:/RESOURCE. The former two are "base URLs" which need to be resolved. The latter two are resolved resource names. Levels of aPACKAGEare separated by'.', not'/'.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCLASS_RESOURCE_URI_PREFIXA special URI-scheme for accessing resources relative to a ClassLoader.static intCLASS_RESOURCE_URI_PREFIX_LENGTHThe length of CLASS_RESOURCE_URI_PREFIX, including ":/".
-
Constructor Summary
Constructors Constructor Description ResourceStreamHandler(java.lang.Class clas)ResourceStreamHandler(java.lang.ClassLoader cloader)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.net.URLmakeURL(java.lang.Class clas)java.net.URLConnectionopenConnection(java.net.URL u)
-
-
-
Field Detail
-
CLASS_RESOURCE_URI_PREFIX
public static final java.lang.String CLASS_RESOURCE_URI_PREFIX
A special URI-scheme for accessing resources relative to a ClassLoader. The resource is found using ClassLoader's getResource method. The actual ClassLoader is found using getClassLoaderForURI.- See Also:
- Constant Field Values
-
CLASS_RESOURCE_URI_PREFIX_LENGTH
public static final int CLASS_RESOURCE_URI_PREFIX_LENGTH
The length of CLASS_RESOURCE_URI_PREFIX, including ":/".- See Also:
- Constant Field Values
-
-
Method Detail
-
makeURL
public static java.net.URL makeURL(java.lang.Class clas) throws java.net.MalformedURLException- Throws:
java.net.MalformedURLException
-
openConnection
public java.net.URLConnection openConnection(java.net.URL u) throws java.io.IOException- Specified by:
openConnectionin classjava.net.URLStreamHandler- Throws:
java.io.IOException
-
-