stringWithContentsOfFile static method

NSMutableString? stringWithContentsOfFile(
  1. NSString path, {
  2. required int encoding,
})
override

stringWithContentsOfFile:encoding:error:

Implementation

static NSMutableString? stringWithContentsOfFile(
  NSString path, {
  required int encoding,
}) {
  final $err = pkg_ffi.calloc<ffi.Pointer<objc.ObjCObjectImpl>>();
  try {
    final $ret = _objc_msgSend_1nomli1(
      _class_NSMutableString,
      _sel_stringWithContentsOfFile_encoding_error_,
      path.ref.pointer,
      encoding,
      $err,
    );
    objc.NSErrorException.checkErrorPointer($err.value);
    return $ret.address == 0
        ? null
        : NSMutableString.fromPointer($ret, retain: true, release: true);
  } finally {
    pkg_ffi.calloc.free($err);
  }
}