Package com.l2fprod.util
Class ZipResourceLoader
java.lang.Object
com.l2fprod.util.ZipResourceLoader
Loads files from a local or network zip archive.
- Author:
- fred
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclass
A class that represents a file contained in a zip archive. -
Constructor Summary
ConstructorsConstructorDescriptionZipResourceLoader
(InputStream p_JarStream) Creates a ZipResourceLoader that loads data from an InputStream.ZipResourceLoader
(URL p_JarUrl) Creates a ZipResourceLoader that loads data from an URL. -
Method Summary
Modifier and TypeMethodDescriptionvoid
dump()
A debugging method.entries()
Gets the files contained in this zip archive.getResource
(String name) Gets the URL of a file in the archive.getResourceAsStream
(String name) Opens an InputStream from a file contained in the archive.getZipResource
(String name) Gets a ZipResource representing the file.getZipResource
(URL name) Gets a ZipResource representing the file.static void
Diagnostic for the ZipResource class.void
release()
Releases the resources claimed by this object.
-
Constructor Details
-
ZipResourceLoader
Creates a ZipResourceLoader that loads data from an URL.- Parameters:
p_JarUrl
- URL to load files from.- Throws:
IOException
- if there is an exception while loading the archive.
-
ZipResourceLoader
Creates a ZipResourceLoader that loads data from an InputStream.- Throws:
IOException
-
-
Method Details
-
getResourceAsStream
Opens an InputStream from a file contained in the archive.- Parameters:
name
- Name of the file to retrieve.- Returns:
- An input stream from the file.
-
getResource
Gets the URL of a file in the archive.- Parameters:
name
- Name of the file to retrieve.- Returns:
- The URL of the file.
- Throws:
MalformedURLException
- If the URL is malformed.
-
getZipResource
Gets a ZipResource representing the file.- Parameters:
name
- The name of the file to retrieve.- Returns:
- The ZipResource representing the file
-
getZipResource
Gets a ZipResource representing the file.- Parameters:
name
- The URL of the resource to retrieve.- Returns:
- The ZipResource representing the file.
-
entries
Gets the files contained in this zip archive.- Returns:
- An Enumeration of the files in this archive.
-
dump
public void dump()A debugging method. -
release
public void release()Releases the resources claimed by this object. -
main
Diagnostic for the ZipResource class.- Parameters:
args
- The command line arguments- Throws:
Exception
- If anything whatsoever goes wrong. :-)
-