當前位置: 首頁>>代碼示例>>C#>>正文


C# BsonBuffer.ReadBytes方法代碼示例

本文整理匯總了C#中MongoDB.Bson.IO.BsonBuffer.ReadBytes方法的典型用法代碼示例。如果您正苦於以下問題:C# BsonBuffer.ReadBytes方法的具體用法?C# BsonBuffer.ReadBytes怎麽用?C# BsonBuffer.ReadBytes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在MongoDB.Bson.IO.BsonBuffer的用法示例。


在下文中一共展示了BsonBuffer.ReadBytes方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: RemoveLastDocument

 internal byte[] RemoveLastDocument(BsonBuffer buffer)
 {
     var lastDocumentLength = buffer.Position - _lastDocumentStartPosition;
     buffer.Position = _lastDocumentStartPosition;
     var lastDocument = buffer.ReadBytes(lastDocumentLength);
     buffer.Length = _lastDocumentStartPosition;
     BackpatchMessageLength(buffer);
     return lastDocument;
 }
開發者ID:pwelter34,項目名稱:mongo-csharp-driver,代碼行數:9,代碼來源:MongoInsertMessage.cs

示例2: RemoveOverflow

            private IByteBuffer RemoveOverflow(BsonBuffer buffer)
            {
                var lastRequestLength = buffer.Position - _lastRequestPosition;
                buffer.Position = _lastRequestPosition;
                var lastArrayItem = buffer.ReadBytes(lastRequestLength);
                if ((BsonType)lastArrayItem[0] != BsonType.Document)
                {
                    throw new MongoInternalException("Expected overflow item to be a BsonDocument.");
                }
                var sliceOffset = Array.IndexOf<byte>(lastArrayItem, 0) + 1; // skip over type and array index
                var overflow = new ByteArrayBuffer(lastArrayItem, sliceOffset, lastArrayItem.Length - sliceOffset, true);
                buffer.Position = _lastRequestPosition;
                buffer.Length = _lastRequestPosition;

                _batchCount--;
                _batchLength = buffer.Position - _batchStartPosition;

                return overflow;
            }
開發者ID:Khosrow-Azizi,項目名稱:MasterExperimentV2,代碼行數:19,代碼來源:BulkUnmixedWriteOperationBase.cs

示例3: RemoveLastDocument

        private byte[] RemoveLastDocument(BsonBuffer buffer)
        {
            var lastDocumentLength = buffer.Position - _lastDocumentStartPosition;
            buffer.Position = _lastDocumentStartPosition;
            var lastDocument = buffer.ReadBytes(lastDocumentLength);
            buffer.Position = _lastDocumentStartPosition;
            buffer.Length = _lastDocumentStartPosition;

            _batchCount -= 1;
            _batchLength = buffer.Position - _batchStartPosition;

            return lastDocument;
        }
開發者ID:Khosrow-Azizi,項目名稱:MasterExperimentV2,代碼行數:13,代碼來源:MongoInsertMessage.cs


注:本文中的MongoDB.Bson.IO.BsonBuffer.ReadBytes方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。