}
// Debug.debug("uncompressed", uncompressed.length);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DeflaterOutputStream dos = new DeflaterOutputStream(baos);
int chunk_size = 256 * 1024;
for (int index = 0; index < uncompressed.length; index += chunk_size)
{
int end = Math.min(uncompressed.length, index + chunk_size);
int length = end - index;
dos.write(uncompressed, index, length);
dos.flush();
baos.flush();
byte compressed[] = baos.toByteArray();
baos.reset();
if (compressed.length > 0)
{
// Debug.debug("compressed", compressed.length);
writeChunkIDAT(os, compressed);
}
}
{
dos.finish();
byte compressed[] = baos.toByteArray();
if (compressed.length > 0)
{
// Debug.debug("compressed final", compressed.length);
writeChunkIDAT(os, compressed);