Inflater inflater = new Inflater();
byte[] ioBuffer = new byte[20000];
byte[] data = new byte[getBytesPerRow()];
// determine how many bytes have to be read from inflater
int numRows = getY2();
TIFFImageFileDirectory ifd = getImageFileDirectory();
if (numRows > ifd.getHeight() - 1)
{
numRows = ifd.getHeight() - 1;
}
numRows -= getY1();
int remainingBytes = numRows * data.length;
// now read and decompress as long as there is data left to decompress
while (compressedSize > 0 || remainingBytes > 0)