本文整理汇总了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;
}
示例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;
}
示例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;
}