本文整理匯總了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;
}