Esempio n. 1
0
    private void EndDocument(bool includeEeo)
    {
      var old = _current;
      if (includeEeo)
      {
        Written(1);
        _writer.Write((byte)0);
      }

      _writer.Seek(_current.Length, SeekOrigin.Begin);
      _writer.Write(_current.Digested); // override the document length placeholder
      _writer.Seek(0, SeekOrigin.End); // back to the end

      _current = _current.Parent;
      if (_current != null)
      {
        Written(old.Digested);
      }
    }
Esempio n. 2
0
 private void NewDocument()
 {
   var old = _current;
   _current = new BsonDocument { Parent = old, Length = (int)_writer.BaseStream.Position, Digested = 4 };
   _writer.Write(0); // length placeholder
 }