protected void load(ZipFile zipfile) throws IOException { Enumeration entries = zipfile.entries(); while (entries.hasMoreElements()) { ZipEntry entry = (ZipEntry) entries.nextElement(); fireBeginFile(entry.getName()); Logger.getLogger(getClass()) .debug("Starting file " + entry.getName() + " (" + entry.getSize() + " bytes)"); byte[] bytes = null; InputStream in = null; try { in = zipfile.getInputStream(entry); bytes = readBytes(in); } finally { if (in != null) { try { in.close(); } catch (IOException ex) { // Ignore } } } Logger.getLogger(getClass()) .debug("Passing up file " + entry.getName() + " (" + bytes.length + " bytes)"); getLoader().load(entry.getName(), new ByteArrayInputStream(bytes)); fireEndFile(entry.getName()); } }
protected void load(ZipInputStream in) throws IOException { ZipEntry entry; while ((entry = in.getNextEntry()) != null) { fireBeginFile(entry.getName()); Logger.getLogger(getClass()) .debug("Starting file " + entry.getName() + " (" + entry.getSize() + " bytes)"); byte[] bytes = readBytes(in); Logger.getLogger(getClass()) .debug("Passing up file " + entry.getName() + " (" + bytes.length + " bytes)"); getLoader().load(entry.getName(), new ByteArrayInputStream(bytes)); fireEndFile(entry.getName()); } }