public static FLSliceResult FLEncode(this object obj)
        {
            var enc = Native.FLEncoder_New();

            try {
                obj.FLEncode(enc);
                FLError err;
                var     retVal = NativeRaw.FLEncoder_Finish(enc, &err);
                if (retVal.buf == null)
                {
                    throw new CouchbaseFleeceException(err);
                }

                return(retVal);
            } finally {
                Native.FLEncoder_Free(enc);
            }
        }
Exemplo n.º 2
0
        public static FLSliceResult FLEncode(this object obj)
        {
            var enc = Native.FLEncoder_New();

            try {
                obj.FLEncode(enc);
                FLError err;
                var     retVal = NativeRaw.FLEncoder_Finish(enc, &err);
                if (retVal.buf == null)
                {
                    throw new LiteCoreException(new C4Error(C4ErrorDomain.FleeceDomain, (int)err));
                }

                return(retVal);
            } finally {
                Native.FLEncoder_Free(enc);
            }
        }
Exemplo n.º 3
0
 public static byte[] FLEncoder_Finish(FLEncoder *encoder, FLError *outError)
 {
     using (var retVal = NativeRaw.FLEncoder_Finish(encoder, outError)) {
         return(((C4Slice)retVal).ToArrayFast());
     }
 }
 public FLSliceResult FLEncoder_Finish(FLEncoder *encoder, FLError *outError) => NativeRaw.FLEncoder_Finish(encoder, outError);