public class JarRegistry extends Object implements ResourceRegistry
Modifier | Constructor and Description |
---|---|
|
JarRegistry(JarFile jf)
Default constructor.
|
|
JarRegistry(JarInputStream jis)
Alternate constructor.
|
protected |
JarRegistry(Map<String,byte[]> dataMap)
Internal constructor.
|
Modifier and Type | Method and Description |
---|---|
protected static Map<String,byte[]> |
createDataMap(JarFile jf)
Creates a mapping of pathnames to data from a
JarFile . |
protected static Map<String,byte[]> |
createDataMap(JarInputStream jis)
Creates a mapping of pathnames to data from a
JarInputStream . |
Map<String,byte[]> |
getDataMap()
Gets the
Map of resource pathnames to byte arrays. |
URL |
getResource(String pathname)
Gets a resource
URL corresponding to the given pathname. |
InputStream |
getResourceAsStream(String pathname)
Gets an
InputStream to the resource at the given pathname. |
Enumeration<URL> |
getResources(String pathname)
Gets all resource
URL s corresponding to the given pathname. |
String |
toString()
Creates a human-readable representation of this registry.
|
public JarRegistry(JarFile jf) throws IOException
IOException
- when something goes awry.public JarRegistry(JarInputStream jis) throws IOException
IOException
- when something goes awry.public Map<String,byte[]> getDataMap()
Map
of resource pathnames to byte
arrays.public URL getResource(String pathname)
ResourceRegistry
URL
corresponding to the given pathname.getResource
in interface ResourceRegistry
pathname
- the resource pathname.URL
or null
if not found.public Enumeration<URL> getResources(String pathname)
ResourceRegistry
URL
s corresponding to the given pathname.getResources
in interface ResourceRegistry
pathname
- the resource pathname.Enumeration
of resource URL
s.public InputStream getResourceAsStream(String pathname)
ResourceRegistry
InputStream
to the resource at the given pathname.getResourceAsStream
in interface ResourceRegistry
pathname
- the resource pathname.InputStream
to the resource or null
if not found.public String toString()
protected static final Map<String,byte[]> createDataMap(JarInputStream jis) throws IOException
JarInputStream
.IOException
- when something goes awry.protected static final Map<String,byte[]> createDataMap(JarFile jf) throws IOException
JarFile
.IOException
- when something goes awry.