ZSTD_compress2 method

int ZSTD_compress2(
  1. Pointer<ZSTD_CCtx> cctx,
  2. Pointer<Void> dst,
  3. int dstCapacity,
  4. Pointer<Void> src,
  5. int srcSize,
)

! ZSTD_compress2() : Behave the same as ZSTD_compressCCtx(), but compression parameters are set using the advanced API. (note that this entry point doesn't even expose a compression level parameter). ZSTD_compress2() always starts a new frame. Should cctx hold data from a previously unfinished frame, everything about it is forgotten.

  • Compression parameters are pushed into CCtx before starting compression, using ZSTD_CCtx_set*()
  • The function is always blocking, returns when compression is completed. NOTE: Providing dstCapacity >= ZSTD_compressBound(srcSize) guarantees that zstd will have enough space to successfully compress the data, though it is possible it fails for other reasons. @return : compressed size written into dst (<= `dstCapacity), or an error code if it fails (which can be tested using ZSTD_isError()).

Implementation

int ZSTD_compress2(
  ffi.Pointer<ZSTD_CCtx> cctx,
  ffi.Pointer<ffi.Void> dst,
  int dstCapacity,
  ffi.Pointer<ffi.Void> src,
  int srcSize,
) {
  return _ZSTD_compress2(
    cctx,
    dst,
    dstCapacity,
    src,
    srcSize,
  );
}