if (len > 0) { deflater.setInput(buffer, 0, len); } else { isFinished = true; deflater.finish(); } }
if (len > 0) deflater.setInput(buffer, 0, len); else { isFinished = true; deflater.finish(); } }
  public Value gzdeflate(InputStream data,                         @Optional("6") int level)  {    try {      Deflater deflater = new Deflater(level, true);      TempBuffer buf = TempBuffer.allocate();      byte []buffer = buf.getBuffer();      boolean isFinished = false;      TempStream out = new TempStream();      while (! isFinished) {	while (! isFinished && deflater.needsInput()) {	  int len = data.read(buffer, 0, buffer.length);	  if (len > 0) {	    deflater.setInput(buffer, 0, len);	  }	  else {	    isFinished = true;	    deflater.finish();	  }	}	int len;	while ((len = deflater.deflate(buffer, 0, buffer.length)) > 0) {	  out.write(buffer, 0, len, false);	}      }      deflater.end();      TempBuffer.free(buf);      return new TempBufferStringValue(out.getHead());    } catch (Exception e) {      throw QuercusModuleException.create(e);    }  }