com.healthmarketscience.common.util.resource
Class Handler

java.lang.Object
  extended by java.net.URLStreamHandler
      extended by com.healthmarketscience.common.util.resource.Handler

public class Handler
extends URLStreamHandler

Classpath resource URLHandler provides easy access to resources via the classloader system. URL's take the form of

  resource:/com/company/path/to/file.txt
 

Author:
Tim McCune
See Also:
URL

Constructor Summary
Handler()
           
 
Method Summary
 URL convertToSystemURL(URL u)
           
static void init()
          Classes that need to handle resource-style URLs can call this message to ensure that this class is initialized.
protected  URLConnection openConnection(URL u)
          Opens a connection to the object referenced by the URL argument.
protected  void parseURL(URL u, String spec, int start, int limit)
          Parse a string into a URL object.
 
Methods inherited from class java.net.URLStreamHandler
equals, getDefaultPort, getHostAddress, hashCode, hostsEqual, openConnection, sameFile, setURL, setURL, toExternalForm
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Handler

public Handler()
Method Detail

init

public static void init()
Classes that need to handle resource-style URLs can call this message to ensure that this class is initialized.


parseURL

protected void parseURL(URL u,
                        String spec,
                        int start,
                        int limit)
Parse a string into a URL object. Host and port are not changed. Only the file attribute is changed.

Overrides:
parseURL in class URLStreamHandler

openConnection

protected URLConnection openConnection(URL u)
                                throws IOException
Opens a connection to the object referenced by the URL argument.

Specified by:
openConnection in class URLStreamHandler
Throws:
IOException

convertToSystemURL

public URL convertToSystemURL(URL u)


Copyright © 2006-2016 Health Market Science. All Rights Reserved.