public void load() throws ModuleUpgradeException, ModuleJarException, InvalidModuleXmlException {
try {
logger.debug("Loading module JAR " + filename);
ZipFile zf = new ZipFile(DataCrow.moduleDir + filename);
Map<String, byte[]> content = new HashMap<String, byte[]>();
Enumeration<? extends ZipEntry> list = zf.entries();
while (list.hasMoreElements()) {
ZipEntry ze = list.nextElement();
BufferedInputStream bis = new BufferedInputStream(zf.getInputStream(ze));
int size = (int) ze.getSize();
byte[] bytes = new byte[size];
bis.read(bytes);
String filename = ze.getName();
content.put(filename, bytes);
bis.close();
}
// first get the XML file
for (String filename : content.keySet()) {
if (filename.toLowerCase().endsWith("xml"))
module = new XmlModule(content.get(filename));
}
byte[] icon16 = content.get(module.getIcon16Filename());
byte[] icon32 = content.get(module.getIcon32Filename());
module.setIcon16(icon16);
module.setIcon32(icon32);
zf.close();
} catch (ZipException e) {
throw new ModuleJarException(e, "An error occured while reading zipfile " + filename);
} catch (NullPointerException e) {
throw new ModuleJarException(e);