// streams to contain components
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ZipOutputStream zos = new ZipOutputStream(bos);
// new zip stats to gather info about zip
ZipStats stats = new ZipStats();
// add each component in component list to zip
for (Component component : componentList) {
if (manifestsOnly && !component.isPackageManifest()) {
continue;
}
IFile file = component.getFileResource();
IPath path = file.getFullPath();
stats.addStats(ZipUtils.zipFile(file.getProjectRelativePath().toPortableString(), path.toFile(), zos,
Integer.MAX_VALUE));
}
// close zip stream and get bytes
zos.close();
zipAsBytes = bos.toByteArray();
if (logger.isDebugEnabled()) {
logger.debug(stats.toString());
}
return zipAsBytes;
}