}
}
void read(URI id, InputStream stream, final DatatypeFactory dfactory)
throws IOException {
TreeWriter tree = new TreeWriter(runtime);
tree.startDocument(step.getNode().getBaseURI());
tree.addStartElement(c_zipfile);
tree.addAttribute(_href, id.toASCIIString());
tree.startContent();
ZipInputStream zipStream = new ZipInputStream(stream);
try {
GregorianCalendar cal = new GregorianCalendar();
ZipEntry entry = zipStream.getNextEntry();
while (entry != null) {
cal.setTimeInMillis(entry.getTime());
XMLGregorianCalendar xmlCal = dfactory.newXMLGregorianCalendar(cal);
if (entry.isDirectory()) {
tree.addStartElement(c_directory);
} else {
tree.addStartElement(c_file);
tree.addAttribute(_compressed_size, ""+entry.getCompressedSize());
tree.addAttribute(_size, ""+entry.getSize());
}
if (entry.getComment() != null) {
tree.addAttribute(_comment, entry.getComment());
}
tree.addAttribute(_name, ""+entry.getName());
tree.addAttribute(_date, xmlCal.toXMLFormat());
tree.startContent();
tree.addEndElement();
entry = zipStream.getNextEntry();
}
tree.addEndElement();
tree.endDocument();
result.write(tree.getResult());
} finally {
zipStream.close();
}
}