compressedDataUsingAlgorithm method

NSData? compressedDataUsingAlgorithm(
  1. NSDataCompressionAlgorithm algorithm
)

compressedDataUsingAlgorithm:error:

iOS: introduced 13.0.0 macOS: introduced 10.15.0

Implementation

NSData? compressedDataUsingAlgorithm(NSDataCompressionAlgorithm algorithm) {
  objc.checkOsVersionInternal(
    'NSData.compressedDataUsingAlgorithm:error:',
    iOS: (false, (13, 0, 0)),
    macOS: (false, (10, 15, 0)),
  );
  final $err = pkg_ffi.calloc<ffi.Pointer<objc.ObjCObjectImpl>>();
  try {
    final $ret = _objc_msgSend_1vnlaqg(
      object$.ref.pointer,
      _sel_compressedDataUsingAlgorithm_error_,
      algorithm.value,
      $err,
    );
    objc.NSErrorException.checkErrorPointer($err.value);
    return $ret.address == 0
        ? null
        : NSData.fromPointer($ret, retain: true, release: true);
  } finally {
    pkg_ffi.calloc.free($err);
  }
}