本文整理汇总了C#中ByteArrayBuffer类的典型用法代码示例。如果您正苦于以下问题:C# ByteArrayBuffer类的具体用法?C# ByteArrayBuffer怎么用?C# ByteArrayBuffer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ByteArrayBuffer类属于命名空间,在下文中一共展示了ByteArrayBuffer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CompleteInterruptedTransaction
public override void CompleteInterruptedTransaction(int transactionId1, int transactionId2
)
{
if (!File.Exists(LockFileName(_fileName)))
{
return;
}
if (!LockFileSignalsInterruptedTransaction())
{
return;
}
var buffer = new ByteArrayBuffer(Const4.IntLength);
OpenLogFile();
Read(_logFile, buffer);
var length = buffer.ReadInt();
if (length > 0)
{
buffer = new ByteArrayBuffer(length);
Read(_logFile, buffer);
buffer.IncrementOffset(Const4.IntLength);
ReadWriteSlotChanges(buffer);
}
DeleteLockFile();
CloseLogFile();
DeleteLogFile();
}
示例2: WriteIndexEntry
public virtual void WriteIndexEntry(IContext context, ByteArrayBuffer writer, object
obj)
{
var slot = (Slot) obj;
writer.WriteInt(slot.Address());
writer.WriteInt(slot.Length());
}
示例3: Read
public static SerializedGraph Read(ByteArrayBuffer buffer
)
{
var id = buffer.ReadInt();
var length = buffer.ReadInt();
return new SerializedGraph(id, buffer.ReadBytes(length));
}
示例4: UnmarshallingContext
public UnmarshallingContext(Transaction transaction, ByteArrayBuffer buffer, ObjectReference
@ref, int addToIDTree, bool checkIDTree) : base(transaction, buffer, null, @ref
)
{
_addToIDTree = addToIDTree;
_checkIDTree = checkIDTree;
}
示例5: Encode
private static ByteArrayBuffer Encode(Encoding charset, string @string)
{
ByteBuffer encoded = charset.Encode(CharBuffer.Wrap(@string));
ByteArrayBuffer bab = new ByteArrayBuffer(encoded.Remaining());
bab.Append(((byte[])encoded.Array()), encoded.Position(), encoded.Remaining());
return bab;
}
示例6: Read
// _key, _slot._address, _slot._length
public override object Read(ByteArrayBuffer buffer)
{
var id = buffer.ReadInt();
var slot = new Slot
(buffer.ReadInt(), buffer.ReadInt());
return new IdSlotTree(id, slot);
}
示例7: WriteBuffer
protected override void WriteBuffer(ByteArrayBuffer buffer, bool shuttingDown)
{
base.WriteBuffer(buffer, shuttingDown);
var systemData = SystemData();
buffer.WriteInt(systemData.IdToTimestampIndexId());
buffer.WriteInt(systemData.TimestampToIdIndexId());
}
示例8: ReadName
private byte[] ReadName(LatinStringIO sio, ByteArrayBuffer reader)
{
var nameBytes = sio.Bytes(reader);
reader.IncrementOffset(nameBytes.Length);
nameBytes = Platform4.UpdateClassName(nameBytes);
return nameBytes;
}
示例9: WriteIndexEntry
public virtual void WriteIndexEntry(IContext context, ByteArrayBuffer reader, object
obj)
{
var mappedIDs = (MappedIDPair) obj;
_origHandler.WriteIndexEntry(context, reader, mappedIDs.Orig());
_mappedHandler.WriteIndexEntry(context, reader, mappedIDs.Mapped());
}
示例10: Bytes
public virtual byte[] Bytes(ByteArrayBuffer buffer)
{
var len = buffer.ReadInt();
len = BytesPerChar()*len;
var res = new byte[len];
Array.Copy(buffer._buffer, buffer._offset, res, 0, len);
return res;
}
示例11: WriteShort
internal static void WriteShort(int a_short, ByteArrayBuffer a_bytes)
{
for (var i = 0; i < Const4.ShortBytes; i++)
{
a_bytes._buffer[a_bytes._offset++] = (byte) (a_short >> ((Const4.ShortBytes - 1 -
i)*8));
}
}
示例12: Read1
internal override object Read1(ByteArrayBuffer a_bytes)
{
var b1 = a_bytes.ReadByte();
var b2 = a_bytes.ReadByte();
var ret = (char) ((b1 & unchecked(0xff)) | ((b2 & unchecked(0xff))
<< 8));
return ret;
}
示例13: MultipartReader
public MultipartReader(string contentType, MultipartReaderDelegate delegate_)
{
this.contentType = contentType;
this.delegate_ = delegate_;
this.buffer = new ByteArrayBuffer(1024);
this.state = MultipartReader.MultipartReaderState.kAtStart;
ParseContentType();
}
示例14: ReadBuffer
protected override void ReadBuffer(ByteArrayBuffer buffer, bool versionsAreConsistent
)
{
base.ReadBuffer(buffer, versionsAreConsistent);
var systemData = SystemData();
systemData.IdToTimestampIndexId(buffer.ReadInt());
systemData.TimestampToIdIndexId(buffer.ReadInt());
}
示例15: ReadFloat
public override object ReadFloat(ByteArrayBuffer bytes)
{
var value = UnmarshallFloat(bytes);
if (float.IsNaN(value))
{
return null;
}
return value;
}