|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectmegamek.common.util.ZippedItems
public class ZippedItems
This class represents a collection of item files present within a ZIP or JAR file, categorized according to their directories. This collection will *not* include all files inside of JAR and ZIP files that are located *inside* the file (i.e. it ignores all nested JAR and ZIP files).
Please note, from this point on, the term "ZIP file" will be taken to mean "ZIP or JAR file", because a JAR file is just a ZIP file with a manifest. Also note, the author plans to eventually handle nested ZIP files, but the effort was deemed to be unnecessary for the needs that led to the initial implementation. Created on January 18, 2004
| Constructor Summary | |
|---|---|
ZippedItems(java.io.File zipFile,
java.lang.String categoryName,
ItemFileFactory itemFactory)
Create a categorized collection of all files within a ZIP file. |
|
| Method Summary | |
|---|---|
java.util.Iterator<java.lang.String> |
getCategoryNames()
Get the names of all the categories. |
java.lang.Object |
getItem(java.lang.String categoryName,
java.lang.String itemName)
Get the indicated item from the correct catagory. |
java.util.Iterator<java.lang.String> |
getItemNames(java.lang.String categoryName)
Get the names of all the items in one of the categories. |
static boolean |
isZipName(java.lang.String name)
Identify when a name belongs to a ZIP file. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ZippedItems(java.io.File zipFile,
java.lang.String categoryName,
ItemFileFactory itemFactory)
throws java.lang.IllegalArgumentException,
java.util.zip.ZipException,
java.io.IOException
zipFile - - the File object for the ZIP file
containing the image files. All files in this ZIP file, will
be included in this collection, categorized by directory. This
value must not be null and it must be a ZIP
file.categoryName - - the String root category name for
this collection. All sub-categories will include this name.
This value may be null (it will be replaced).itemFactory - - the ItemFileFactory that will create
ItemFiles for the contents of the directory.
This value must not be null.
IllegalArgumentException - if zipFile
or itemFactory is null.
ZipException - if there's a ZIP error opening
zipFile.
IOException - if there's an IO error opening
zipFile.
java.lang.IllegalArgumentException
java.util.zip.ZipException
java.io.IOException| Method Detail |
|---|
public static boolean isZipName(java.lang.String name)
name - - the String which may be a ZIP file name.
This value must not be null.
true if the name is for a ZIP file.
false if the name is not for a ZIP file.
IllegalArgumentException - if name is
null.public java.util.Iterator<java.lang.String> getCategoryNames()
getCategoryNames in interface CategorizedEnumeration of String names.
This value will not be null, but it may be empty.public java.util.Iterator<java.lang.String> getItemNames(java.lang.String categoryName)
getItemNames in interface CategorizedcategoryName - - the String name of the category
whose item names are required.
Enumeration of String names.
This value will not be null, but it may be empty.
public java.lang.Object getItem(java.lang.String categoryName,
java.lang.String itemName)
throws java.lang.Exception
getItem in interface CategorizedcategoryName - - the String name of the category
whose item names are required.itemName - - the String name of the indicated item.
Object in the correct category with the given
name. This value may be null.
- Throws:
Exception - if there's any error getting the item.
java.lang.Exception
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||