|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.norther.tammi.acorn.util.zip.JarHandler
public class JarHandler
A small handler around a Jar
Based on JarHolder
in the Apache Jakarta Velocity project.
Field Summary | |
---|---|
static String |
JAR_ENTRY_DELIMITER
The jar entry delimiter. |
static String |
JAR_FILE_PROTOCOL
The jar file protocol. |
static String |
JAR_FILE_PROTOCOL_PREFIX
The jar file protocol prefix. |
static String |
JAR_HTTP_PROTOCOL
The jar http protocol. |
static String |
JAR_PROTOCOL
The jar protocol. |
static String |
JAR_PROTOCOL_PREFIX
The jar protocol prefix. |
Constructor Summary | |
---|---|
JarHandler(File file)
Constructs a new jar handler. |
|
JarHandler(File file,
String dir)
Constructs a new jar handler. |
|
JarHandler(String path)
Constructs a new jar handler. |
|
JarHandler(URL url)
Constructs a new jar handler. |
Method Summary | |
---|---|
void |
close()
Closes the jar. |
Map<String,String> |
getEntries()
Gets entries from the URL directory of the jar. |
JarEntry |
getEntry(String source)
Gets a resource entry. |
JarFile |
getJar()
Gets the jar. |
static String |
getJarEntryPath(String path)
Gets the jar entry path of the specified jar path. |
static String |
getJarEntryPath(URL url)
Gets the jar entry path of the specified jar URL. |
static String |
getJarFilePath(String path)
Gets the jar file path of the specified jar path. |
static String |
getJarFilePath(URL url)
Gets the jar file path of the specified jar URL. |
static String |
getJarProtocol(String path)
Gets the jar protocol of the specified jar path. |
static String |
getJarProtocol(URL url)
Gets the jar protocol of the specified jar URL. |
InputStream |
getResourceAsStream(String source)
Gets a resource stream. |
String |
getURLPath()
Gets the URL path of the jar. |
static URL |
toJarURL(String protocol,
String path)
Converts the specified path into a jar URL. |
static URL |
toJarURL(String protocol,
String path,
String entry)
Converts the specified path and entry into a jar URL. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String JAR_PROTOCOL
public static final String JAR_FILE_PROTOCOL
public static final String JAR_HTTP_PROTOCOL
public static final String JAR_PROTOCOL_PREFIX
public static final String JAR_FILE_PROTOCOL_PREFIX
public static final String JAR_ENTRY_DELIMITER
Constructor Detail |
---|
public JarHandler(URL url)
url
- URL to the jar.
IllegalStateException
- if not available.public JarHandler(File file)
file
- the jar file.
IllegalStateException
- if not available.public JarHandler(File file, String dir)
file
- the jar file.dir
- the directory.
IllegalStateException
- if not available.public JarHandler(String path)
path
- the URL path of the jar.
IllegalStateException
- if not available.Method Detail |
---|
public static String getJarProtocol(URL url)
url
- the jar URL.
public static String getJarProtocol(String path)
path
- the jar path.
public static String getJarFilePath(URL url)
url
- the jar URL.
public static String getJarFilePath(String path)
path
- the jar path.
public static String getJarEntryPath(URL url)
url
- the jar URL.
public static String getJarEntryPath(String path)
path
- the jar path.
public static URL toJarURL(String protocol, String path) throws MalformedURLException
protocol
- the protocol.path
- the path.
MalformedURLException
- for an invalid path.public static URL toJarURL(String protocol, String path, String entry) throws MalformedURLException
protocol
- the protocol.path
- the path.entry
- the entry.
MalformedURLException
- for an invalid path.public void close()
public JarEntry getEntry(String source)
source
- the resource.
IllegalStateException
- if already closed.public InputStream getResourceAsStream(String source) throws IOException
source
- the resource.
IOException
- on I/O errors.
IllegalStateException
- if already closed.public Map<String,String> getEntries()
IllegalStateException
- if already closed.public JarFile getJar()
IllegalStateException
- if already closed.public String getURLPath()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |