Ejemplo n.º 1
0
        /// <summary>
        /// Tries to get the node associated with a name read from a stream.
        /// </summary>
        /// <param name="streamReader">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(BsonStreamReader streamReader, out BsonTrieNode <TValue> node)
        {
            var position = streamReader.Position;
            var utf8     = streamReader.ReadCStringBytes();

            if (TryGetNode(utf8, out node))
            {
                return(true);
            }

            streamReader.Position = position;
            return(false);
        }
 // public methods
 /// <summary>
 /// Decodes the name.
 /// </summary>
 /// <param name="streamReader">The stream reader.</param>
 /// <returns>
 /// The name.
 /// </returns>
 public string Decode(BsonStreamReader streamReader)
 {
     var utf8 = streamReader.ReadCStringBytes();
     return Utf8Helper.DecodeUtf8String(utf8.Array, utf8.Offset, utf8.Count, Utf8Helper.StrictUtf8Encoding);
 }
Ejemplo n.º 3
0
        // public methods
        /// <summary>
        /// Decodes the name.
        /// </summary>
        /// <param name="streamReader">The stream reader.</param>
        /// <returns>
        /// The name.
        /// </returns>
        public string Decode(BsonStreamReader streamReader)
        {
            var utf8 = streamReader.ReadCStringBytes();

            return(Utf8Helper.DecodeUtf8String(utf8.Array, utf8.Offset, utf8.Count, Utf8Helper.StrictUtf8Encoding));
        }