TempBuffer tb = TempBuffer.allocate(); byte[] buffer = tb.getBuffer();
TempBuffer tempBuf = TempBuffer.allocate(); byte[] buffer = tempBuf.getBuffer();
  public Value gzencode(InputStream is,                        @Optional("6") int level,                        @Optional("1") int encodingMode)  {    TempBuffer tb = TempBuffer.allocate();    byte[] buffer = tb.getBuffer();    TempStream ts = new TempStream();    StreamImplOutputStream out = new StreamImplOutputStream(ts);    try {      ZlibOutputStream gzOut;      gzOut = new ZlibOutputStream(out, level, Deflater.DEFAULT_STRATEGY,				   encodingMode);      int len;      while ((len = is.read(buffer, 0, buffer.length)) > 0) {        gzOut.write(buffer, 0, len);      }      gzOut.close();            TempBuffer.free(tb);      return new TempBufferStringValue(ts.getHead());    } catch(IOException e) {      throw QuercusModuleException.create(e);    }  }