/// <summary> /// Tries to get the node associated with a name read from a stream. /// </summary> /// <param name="stream">The stream.</param> /// <param name="node">The node.</param> /// <returns> /// True if the node was found. /// If the node was found the stream is advanced over the name, otherwise /// the stream is repositioned to the beginning of the name. /// </returns> public bool TryGetNode(BsonStream stream, out BsonTrieNode <TValue> node) { var position = stream.Position; var utf8 = stream.ReadCStringBytes(); if (TryGetNode(utf8, out node)) { return(true); } stream.Position = position; return(false); }
static int _m_ReadCStringBytes(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); MongoDB.Bson.IO.BsonStream gen_to_be_invoked = (MongoDB.Bson.IO.BsonStream)translator.FastGetCSObj(L, 1); { System.ArraySegment <byte> gen_ret = gen_to_be_invoked.ReadCStringBytes( ); translator.Push(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
// public methods /// <summary> /// Decodes the name. /// </summary> /// <param name="stream">The stream.</param> /// <param name="encoding">The encoding.</param> /// <returns> /// The name. /// </returns> public string Decode(BsonStream stream, UTF8Encoding encoding) { var utf8 = stream.ReadCStringBytes(); return(Utf8Helper.DecodeUtf8String(utf8.Array, utf8.Offset, utf8.Count, encoding)); }
// public methods /// <summary> /// Decodes the name. /// </summary> /// <param name="stream">The stream.</param> /// <param name="encoding">The encoding.</param> /// <returns> /// The name. /// </returns> public string Decode(BsonStream stream, UTF8Encoding encoding) { var utf8 = stream.ReadCStringBytes(); return Utf8Helper.DecodeUtf8String(utf8.Array, utf8.Offset, utf8.Count, encoding); }