_deflater.setInput(input); _deflater.finish(); byte[] output = new byte[input.length];
  public int gzwrite(Env env,		     String s,                     @Optional("0") int length)  {    if ((_fileValue == null) || (_fileValue == BooleanValue.FALSE)) {      env.warning(L.l("file could not be open for writing"));      return -1;    }    FileValue fileValue = (FileValue) _fileValue;    if (length == 0)      length = s.length();    else      length = Math.min(length, s.length());    byte[] input = s.getBytes();    _deflater.setInput(input);    _deflater.finish();    byte[] output = new byte[input.length];    ByteBuffer buf = new ByteBuffer();    int compressedDataLength;    int fullCompressedDataLength = 0;    while (!_deflater.finished()) {      compressedDataLength = _deflater.deflate(output);      fullCompressedDataLength += compressedDataLength;      buf.append(output,0,compressedDataLength);    }    try {      fileValue.write(buf.getBuffer(), 0, fullCompressedDataLength);      fileValue.flush();    } catch (IOException e) {      log.log(Level.FINE, e.getMessage(), e);      env.warning(L.l(e.getMessage()));    }    return length;  }