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; }
internal override object Read1(ByteArrayBuffer a_bytes) { byte b1 = a_bytes.ReadByte(); byte b2 = a_bytes.ReadByte(); char ret = (char)((b1 & unchecked ((int)(0xff))) | ((b2 & unchecked ((int)(0xff))) << 8)); return(ret); }
protected virtual bool SignatureMatches(ByteArrayBuffer reader, byte[] signature, byte version) { for (int i = 0; i < signature.Length; i++) { if (reader.ReadByte() != signature[i]) { return(false); } } return(reader.ReadByte() == version); }
public virtual void TestGrandChildren() { MarshallingBuffer buffer = new MarshallingBuffer(); buffer.WriteInt(Data1); buffer.WriteByte(Data2); MarshallingBuffer child = buffer.AddChild(); child.WriteInt(Data3); child.WriteInt(Data4); MarshallingBuffer grandChild = child.AddChild(); grandChild.WriteInt(Data5); buffer.MergeChildren(null, 0, 0); ByteArrayBuffer content = InspectContent(buffer); Assert.AreEqual(Data1, content.ReadInt()); Assert.AreEqual(Data2, content.ReadByte()); int address = content.ReadInt(); content.Seek(address); Assert.AreEqual(Data3, content.ReadInt()); Assert.AreEqual(Data4, content.ReadInt()); address = content.ReadInt(); content.Seek(address); Assert.AreEqual(Data5, content.ReadInt()); }
public virtual void TestLinkOffset() { var linkOffset = 7; var buffer = new MarshallingBuffer(); buffer.WriteInt(Data1); buffer.WriteByte(Data2); var child = buffer.AddChild(); child.WriteInt(Data3); child.WriteInt(Data4); var grandChild = child.AddChild(); grandChild.WriteInt(Data5); buffer.MergeChildren(null, 0, linkOffset); var content = InspectContent(buffer); var extendedBuffer = new ByteArrayBuffer(content.Length() + linkOffset ); content.CopyTo(extendedBuffer, 0, linkOffset, content.Length()); extendedBuffer.Seek(linkOffset); Assert.AreEqual(Data1, extendedBuffer.ReadInt()); Assert.AreEqual(Data2, extendedBuffer.ReadByte()); var address = extendedBuffer.ReadInt(); extendedBuffer.Seek(address); Assert.AreEqual(Data3, extendedBuffer.ReadInt()); Assert.AreEqual(Data4, extendedBuffer.ReadInt()); address = extendedBuffer.ReadInt(); extendedBuffer.Seek(address); Assert.AreEqual(Data5, extendedBuffer.ReadInt()); }
protected override void Read(LocalObjectContainer container, ByteArrayBuffer reader ) { NewTimerFileLock(container); OldEncryptionOff(container); CheckThreadFileLock(container, reader); reader.Seek(BlocksizeOffset); container.BlockSizeReadFromFile(reader.ReadInt()); SystemData systemData = container.SystemData(); systemData.ClassCollectionID(reader.ReadInt()); container.SystemData().IdSystemType(reader.ReadByte()); _variablePart = CreateVariablePart(container); int variablePartAddress = reader.ReadInt(); int variablePartLength = reader.ReadInt(); _variablePart.Read(variablePartAddress, variablePartLength); _transactionPointerAddress = reader.ReadInt(); if (_transactionPointerAddress != 0) { ByteArrayBuffer buffer = new ByteArrayBuffer(TransactionPointerLength); buffer.Read(container, _transactionPointerAddress, 0); systemData.TransactionPointer1(buffer.ReadInt()); systemData.TransactionPointer2(buffer.ReadInt()); } }
protected Db4objects.Db4o.Internal.Transaction CheckParentTransaction(Db4objects.Db4o.Internal.Transaction a_trans, ByteArrayBuffer reader) { if (reader.ReadByte() == Const4.SystemTrans && a_trans.ParentTransaction() != null) { return(a_trans.ParentTransaction()); } return(a_trans); }
public virtual void ReadThis(ByteArrayBuffer buffer) { SystemData().ConverterVersion(buffer.ReadInt()); SystemData().FreespaceSystem(buffer.ReadByte()); buffer.ReadInt(); // was BTreeFreespaceId, converted to slot, can no longer be used SystemData().IdentityId(buffer.ReadInt()); SystemData().LastTimeStampID(buffer.ReadLong()); SystemData().UuidIndexId(buffer.ReadInt()); }
private void ReadNodeHeader(ByteArrayBuffer reader) { _count = reader.ReadInt(); byte leafByte = reader.ReadByte(); _isLeaf = (leafByte == 1); _parentID = reader.ReadInt(); _previousID = reader.ReadInt(); _nextID = reader.ReadInt(); }
internal virtual void ReadThis() { Write(Msg.GetClasses.GetWriter(SystemTransaction())); ByteArrayBuffer bytes = ExpectedBufferResponse(Msg.GetClasses); ClassCollection().SetID(bytes.ReadInt()); byte stringEncoding = bytes.ReadByte(); CreateStringIO(stringEncoding); ClassCollection().Read(SystemTransaction()); }
public virtual void TestWrite() { MarshallingBuffer buffer = new MarshallingBuffer(); buffer.WriteInt(Data1); buffer.WriteByte(Data2); ByteArrayBuffer content = InspectContent(buffer); Assert.AreEqual(Data1, content.ReadInt()); Assert.AreEqual(Data2, content.ReadByte()); }
public virtual void TestCopy() { ByteArrayBuffer from = new ByteArrayBuffer(Readerlength); for (int i = 0; i < Readerlength; i++) { from.WriteByte((byte)i); } ByteArrayBuffer to = new ByteArrayBuffer(Readerlength - 1); from.CopyTo(to, 1, 2, 10); Assert.AreEqual(0, to.ReadByte()); Assert.AreEqual(0, to.ReadByte()); for (int i = 1; i <= 10; i++) { Assert.AreEqual((byte)i, to.ReadByte()); } for (int i = 12; i < Readerlength - 1; i++) { Assert.AreEqual(0, to.ReadByte()); } }
internal override object Read1(ByteArrayBuffer a_bytes) { var ret = a_bytes.ReadByte(); if (ret == True) { return true; } if (ret == False) { return false; } return null; }
internal override object Read1(ByteArrayBuffer a_bytes) { byte ret = a_bytes.ReadByte(); if (ret == True) { return(true); } if (ret == False) { return(false); } return(null); }
protected virtual void ReadBuffer(ByteArrayBuffer buffer, bool versionsAreConsistent ) { buffer.IncrementOffset(ChecksumLength); SystemData systemData = SystemData(); systemData.IdSystemSlot(ReadSlot(buffer, false)); systemData.InMemoryFreespaceSlot(ReadSlot(buffer, !versionsAreConsistent)); systemData.BTreeFreespaceId(buffer.ReadInt()); systemData.ConverterVersion(buffer.ReadInt()); systemData.UuidIndexId(buffer.ReadInt()); systemData.IdentityId(buffer.ReadInt()); systemData.LastTimeStampID(buffer.ReadLong()); systemData.FreespaceSystem(buffer.ReadByte()); }
public virtual void TestTransferLastWrite() { MarshallingBuffer buffer = new MarshallingBuffer(); buffer.WriteInt(Data1); int lastOffset = Offset(buffer); buffer.WriteByte(Data2); MarshallingBuffer other = new MarshallingBuffer(); buffer.TransferLastWriteTo(other, true); Assert.AreEqual(lastOffset, Offset(buffer)); ByteArrayBuffer content = InspectContent(other); Assert.AreEqual(Data2, content.ReadByte()); }
protected override RawFieldSpec ReadSpec(AspectType aspectType, ObjectContainerBase stream, ByteArrayBuffer reader) { var name = StringHandler.ReadStringNoDebug(stream.Transaction.Context(), reader ); if (!aspectType.IsFieldMetadata()) { return new RawFieldSpec(aspectType, name); } if (name.IndexOf(Const4.VirtualFieldPrefix) == 0) { if (stream._handlers.VirtualFieldByName(name) != null) { return new RawFieldSpec(aspectType, name); } } var fieldTypeID = reader.ReadInt(); var attribs = reader.ReadByte(); return new RawFieldSpec(aspectType, name, fieldTypeID, attribs); }
protected override RawFieldSpec ReadSpec(AspectType aspectType, ObjectContainerBase stream, ByteArrayBuffer reader) { var name = StringHandler.ReadStringNoDebug(stream.Transaction.Context(), reader ); if (!aspectType.IsFieldMetadata()) { return(new RawFieldSpec(aspectType, name)); } if (name.IndexOf(Const4.VirtualFieldPrefix) == 0) { if (stream._handlers.VirtualFieldByName(name) != null) { return(new RawFieldSpec(aspectType, name)); } } var fieldTypeID = reader.ReadInt(); var attribs = reader.ReadByte(); return(new RawFieldSpec(aspectType, name, fieldTypeID, attribs)); }
protected override void Read(LocalObjectContainer container, ByteArrayBuffer reader ) { NewTimerFileLock(container); OldEncryptionOff(container); CheckThreadFileLock(container, reader); reader.Seek(BlocksizeOffset); container.BlockSizeReadFromFile(reader.ReadInt()); var systemData = container.SystemData(); systemData.ClassCollectionID(reader.ReadInt()); container.SystemData().IdSystemType(reader.ReadByte()); _variablePart = CreateVariablePart(container); var variablePartAddress = reader.ReadInt(); var variablePartLength = reader.ReadInt(); _variablePart.Read(variablePartAddress, variablePartLength); _transactionPointerAddress = reader.ReadInt(); if (_transactionPointerAddress != 0) { var buffer = new ByteArrayBuffer(TransactionPointerLength); buffer.Read(container, _transactionPointerAddress, 0); systemData.TransactionPointer1(buffer.ReadInt()); systemData.TransactionPointer2(buffer.ReadInt()); } }
internal override object Read1(ByteArrayBuffer a_bytes) { var ret = a_bytes.ReadByte(); return ret; }
protected override RawFieldSpec ReadSpec(AspectType aspectType, ObjectContainerBase stream, ByteArrayBuffer reader) { return base.ReadSpec(AspectType.ForByte(reader.ReadByte()), stream, reader); }
protected virtual bool SignatureMatches(ByteArrayBuffer reader, byte[] signature, byte version) { for (var i = 0; i < signature.Length; i++) { if (reader.ReadByte() != signature[i]) { return false; } } return reader.ReadByte() == version; }
protected override RawFieldSpec ReadSpec(AspectType aspectType, ObjectContainerBase stream, ByteArrayBuffer reader) { return(base.ReadSpec(AspectType.ForByte(reader.ReadByte()), stream, reader)); }
protected virtual void ReadBuffer(ByteArrayBuffer buffer, bool versionsAreConsistent ) { buffer.IncrementOffset(ChecksumLength); var systemData = SystemData(); systemData.IdSystemSlot(ReadSlot(buffer, false)); systemData.InMemoryFreespaceSlot(ReadSlot(buffer, !versionsAreConsistent)); systemData.BTreeFreespaceId(buffer.ReadInt()); systemData.ConverterVersion(buffer.ReadInt()); systemData.UuidIndexId(buffer.ReadInt()); systemData.IdentityId(buffer.ReadInt()); systemData.LastTimeStampID(buffer.ReadLong()); systemData.FreespaceSystem(buffer.ReadByte()); }
private void ReadNodeHeader(ByteArrayBuffer reader) { _count = reader.ReadInt(); var leafByte = reader.ReadByte(); _isLeaf = (leafByte == 1); _parentID = reader.ReadInt(); _previousID = reader.ReadInt(); _nextID = reader.ReadInt(); }
public virtual byte ReadByte() { return(_current.ReadByte()); }
internal override object Read1(ByteArrayBuffer a_bytes) { var ret = a_bytes.ReadByte(); return(ret); }