gnu.text
Class ResourceStreamHandler

java.lang.Object
  extended by java.net.URLStreamHandler
      extended by gnu.text.ResourceStreamHandler

public class ResourceStreamHandler
extends java.net.URLStreamHandler

Handler for "class-resource:" URLs. These are "indirect URLs" implemented using ClassLoader.getResource(). Their syntax is: either: class-resource:/PACKAGE/CLASS or class-resource:/CLASS or class-resource:/PACKAGE/RESOURCE or class-resource:/RESOURCE. The former two are "base URLs" which need to be resolved. The latter two are resolved resource names.


Field Summary
static java.lang.String CLASS_RESOURCE_URI_PREFIX
          A special URI-scheme for accessing resources relative to a ClassLoader.
static int CLASS_RESOURCE_URI_PREFIX_LENGTH
          The length of CLASS_RESOURCE_URI_PREFIX, including ":/".
 
Constructor Summary
ResourceStreamHandler(java.lang.ClassLoader cloader)
           
 
Method Summary
static java.net.URL makeURL(java.lang.Class clas)
           
 java.net.URLConnection openConnection(java.net.URL u)
           
 
Methods inherited from class java.net.URLStreamHandler
equals, getDefaultPort, getHostAddress, hashCode, hostsEqual, openConnection, parseURL, sameFile, setURL, setURL, toExternalForm
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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
Constructor Detail

ResourceStreamHandler

public ResourceStreamHandler(java.lang.ClassLoader cloader)
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:
openConnection in class java.net.URLStreamHandler
Throws:
java.io.IOException