final ByteArrayOutputStream baos = new ByteArrayOutputStream();
if (srcManifest.containsKey(uri.toString())) {
XdmNode doc = srcManifest.get(href);
store(file, doc, baos);
} else {
DataStore store = runtime.getDataStore();
store.readEntry(href, href, "*/*", null, new DataReader() {
public void load(URI id, String media,
InputStream stream, long len)
throws IOException {
int read = stream.read(buffer, 0, bufsize);
while (read>0){
baos.write(buffer,0,read);
read = stream.read(buffer, 0, bufsize);
}
}
});
}
byte[] bytes = baos.toByteArray();
ze.setSize(bytes.length);
crc.reset();
crc.update(bytes);
ze.setCrc(crc.getValue());
}
outZip.putNextEntry(ze);
if (srcManifest.containsKey(href)) {
XdmNode doc = srcManifest.get(href);
store(file, doc, outZip);
} else {
DataStore store = runtime.getDataStore();
store.readEntry(href, href, "*/*", null, new DataReader() {
public void load(URI id, String media,
InputStream stream, long len)
throws IOException {
int read = stream.read(buffer, 0, bufsize);
while (read >= 0) {