public class ResourceStreamHandler
extends java.net.URLStreamHandler
"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.
Levels of a PACKAGE
are separated by '.'
, not '/'
.Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
ResourceStreamHandler(java.lang.Class clas) |
ResourceStreamHandler(java.lang.ClassLoader cloader) |
Modifier and Type | Method and Description |
---|---|
static java.net.URL |
makeURL(java.lang.Class clas) |
java.net.URLConnection |
openConnection(java.net.URL u) |
public static final java.lang.String CLASS_RESOURCE_URI_PREFIX
public static final int CLASS_RESOURCE_URI_PREFIX_LENGTH
public ResourceStreamHandler(java.lang.Class clas)
public ResourceStreamHandler(java.lang.ClassLoader cloader)
public static java.net.URL makeURL(java.lang.Class clas) throws java.net.MalformedURLException
java.net.MalformedURLException
public java.net.URLConnection openConnection(java.net.URL u) throws java.io.IOException
openConnection
in class java.net.URLStreamHandler
java.io.IOException