deflater.finish();
deflater.end();
final byte[] data = outputStream.toByteArray();
final ByteArrayInputStream bin = new ByteArrayInputStream(data);
final InflaterInputStream infi = new InflaterInputStream(bin);
final ZipRepository repository = (ZipRepository) item.getRepository();
final String contentId = (String) item.getContentId();
final ZipEntry zipEntry = new ZipEntry(contentId);
final Object comment = item.getAttribute(LibRepositoryBoot.ZIP_DOMAIN, LibRepositoryBoot.ZIP_COMMENT_ATTRIBUTE);
if (comment != null)
{
zipEntry.setComment(String.valueOf(comment));
}
final Object version = item.getAttribute(LibRepositoryBoot.REPOSITORY_DOMAIN, LibRepositoryBoot.VERSION_ATTRIBUTE);
if (version instanceof Date)
{
final Date date = (Date) version;
zipEntry.setTime(date.getTime());
}
final int zipMethod = RepositoryUtilities.getZipMethod(item);
zipEntry.setCrc(crc32.getValue());
if (zipMethod == Deflater.NO_COMPRESSION)
{
zipEntry.setCompressedSize(size);
zipEntry.setSize(size);
}
else
{
zipEntry.setSize(size);
}
repository.writeContent(zipEntry, infi, zipMethod, RepositoryUtilities.getZipLevel(item));
infi.close();
closed = true;
outputStream = null;
deflaterOutputStream = null;
}