@NotNull StreamResource in, @NotNull StreamResource out,
@NotNull BinaryInput in, @NotNull BinaryOutput out,
  public static long stream_copy_to_stream(Env env,                                           @NotNull StreamResource in,                                           @NotNull StreamResource out,                                           @Optional("-1") int length,                                           @Optional int offset)  {    try {      if (in == null)        return -1;      if (out == null)        return -1;      TempBuffer temp = TempBuffer.allocate();      byte []buffer = temp.getBuffer();      while (offset-- > 0)        in.read();      if (length < 0)        length = Integer.MAX_VALUE;      long bytesWritten = 0;      while (length > 0) {        int sublen = buffer.length;        if (length < sublen)          sublen = (int) length;        sublen = in.read(buffer, 0, sublen);        if (sublen < 0)          return bytesWritten;        out.write(buffer, 0, sublen);        bytesWritten += sublen;        length -= sublen;      }      TempBuffer.free(temp);      return bytesWritten;    } catch (IOException e) {      throw new QuercusModuleException(e);    }  }