예제 #1
0
 public override void WriteBytes(ByteArrayBuffer buffer, int blockedAddress, int addressOffset
                                 )
 {
     if (Deploy.debug && !Deploy.flush)
     {
         return;
     }
     if (Debug4.xbytes && Deploy.overwrite)
     {
         if (buffer.CheckXBytes())
         {
             CheckXBytes(blockedAddress, addressOffset, buffer.Length());
         }
         else
         {
             buffer.CheckXBytes(true);
         }
     }
     if (DTrace.enabled)
     {
         DTrace.WriteBytes.LogLength(blockedAddress + addressOffset, buffer.Length());
     }
     _file.BlockWrite(blockedAddress, addressOffset, buffer._buffer, buffer.Length());
     if (_backupFile != null)
     {
         _backupFile.BlockWrite(blockedAddress, addressOffset, buffer._buffer, buffer.Length
                                    ());
     }
 }
예제 #2
0
파일: MsgD.cs 프로젝트: erdincay/db4o
		public Db4objects.Db4o.CS.Internal.Messages.MsgD GetWriterForBuffer(Transaction trans
			, ByteArrayBuffer buffer)
		{
			Db4objects.Db4o.CS.Internal.Messages.MsgD writer = GetWriterForLength(trans, buffer
				.Length());
			writer.WriteBytes(buffer._buffer);
			return writer;
		}
예제 #3
0
		private void AppendPayLoad(StatefulBuffer target, Pointer4 pointer, ByteArrayBuffer
			 payLoad)
		{
			target.WriteInt(payLoad.Length());
			target.WriteInt(pointer.Id());
			target.WriteInt(pointer.Address());
			target.Append(payLoad._buffer);
		}
예제 #4
0
파일: MsgD.cs 프로젝트: masroore/db4o
 public MsgD GetWriterForBuffer(Transaction trans
     , ByteArrayBuffer buffer)
 {
     var writer = GetWriterForLength(trans, buffer
         .Length());
     writer.WriteBytes(buffer._buffer);
     return writer;
 }
        public static void ProcessCopy(IDefragmentServices services, int sourceID, ISlotCopyHandler
                                       command, ByteArrayBuffer sourceReader)
        {
            int  targetID   = services.StrictMappedID(sourceID);
            Slot targetSlot = services.AllocateTargetSlot(sourceReader.Length());

            services.Mapping().MapId(targetID, targetSlot);
            Db4objects.Db4o.Internal.DefragmentContextImpl context = new Db4objects.Db4o.Internal.DefragmentContextImpl
                                                                         (sourceReader, services);
            command.ProcessCopy(context);
            services.TargetWriteBytes(context, targetSlot.Address());
        }
예제 #6
0
		internal MsgD GetWriter(Transaction trans, Pointer4 pointer, ByteArrayBuffer buffer
			, int[] prependInts)
		{
			int lengthNeeded = buffer.Length() + LengthForFirst;
			if (prependInts != null)
			{
				lengthNeeded += (prependInts.Length * Const4.IntLength);
			}
			MsgD message = GetWriterForLength(trans, lengthNeeded);
			if (prependInts != null)
			{
				for (int i = 0; i < prependInts.Length; i++)
				{
					message._payLoad.WriteInt(prependInts[i]);
				}
			}
			AppendPayLoad(message._payLoad, pointer, buffer);
			return message;
		}
예제 #7
0
 public void Encrypt(ByteArrayBuffer reader)
 {
     if (i_encrypt)
     {
         byte[] bytes           = reader._buffer;
         int    encryptorOffSet = i_lastEncryptorByte;
         for (int i = reader.Length() - 1; i >= 0; i--)
         {
             bytes[i] -= i_encryptor[encryptorOffSet];
             if (encryptorOffSet == 0)
             {
                 encryptorOffSet = i_lastEncryptorByte;
             }
             else
             {
                 encryptorOffSet--;
             }
         }
     }
 }
예제 #8
0
 public void Decrypt(ByteArrayBuffer reader)
 {
     if (i_encrypt)
     {
         var encryptorOffSet = i_lastEncryptorByte;
         var bytes           = reader._buffer;
         for (var i = reader.Length() - 1; i >= 0; i--)
         {
             bytes[i] += i_encryptor[encryptorOffSet];
             if (encryptorOffSet == 0)
             {
                 encryptorOffSet = i_lastEncryptorByte;
             }
             else
             {
                 encryptorOffSet--;
             }
         }
     }
 }
		private void Write(IBin storage, ByteArrayBuffer buffer)
		{
			storage.Write(0, buffer._buffer, buffer.Length());
		}
		public override void WriteBytes(ByteArrayBuffer buffer, int blockedAddress, int addressOffset
			)
		{
			if (Deploy.debug && !Deploy.flush)
			{
				return;
			}
			if (Debug4.xbytes && Deploy.overwrite)
			{
				if (buffer.CheckXBytes())
				{
					CheckXBytes(blockedAddress, addressOffset, buffer.Length());
				}
				else
				{
					buffer.CheckXBytes(true);
				}
			}
			if (DTrace.enabled)
			{
				DTrace.WriteBytes.LogLength(blockedAddress + addressOffset, buffer.Length());
			}
			_file.BlockWrite(blockedAddress, addressOffset, buffer._buffer, buffer.Length());
			if (_backupFile != null)
			{
				_backupFile.BlockWrite(blockedAddress, addressOffset, buffer._buffer, buffer.Length
					());
			}
		}
예제 #11
0
		public void Encrypt(ByteArrayBuffer reader)
		{
			if (i_encrypt)
			{
				byte[] bytes = reader._buffer;
				int encryptorOffSet = i_lastEncryptorByte;
				for (int i = reader.Length() - 1; i >= 0; i--)
				{
					bytes[i] -= i_encryptor[encryptorOffSet];
					if (encryptorOffSet == 0)
					{
						encryptorOffSet = i_lastEncryptorByte;
					}
					else
					{
						encryptorOffSet--;
					}
				}
			}
		}
 public int Length()
 {
     return(_source.Length());
 }
예제 #13
0
 public override void WriteBytes(ByteArrayBuffer buffer, int address, int addressOffset
     )
 {
     _memoryBin.Write(address + addressOffset, buffer._buffer, buffer.Length());
 }
예제 #14
0
 public override void WriteBytes(ByteArrayBuffer buffer, int address, int addressOffset
                                 )
 {
     _memoryBin.Write(address + addressOffset, buffer._buffer, buffer.Length());
 }
예제 #15
0
 private int RemainingSize()
 {
     return(_delegate.Length() - _delegate.Offset());
 }
		private void Read(IBin storage, ByteArrayBuffer buffer)
		{
			storage.Read(0, buffer._buffer, buffer.Length());
		}
예제 #17
0
		public static void ProcessCopy(IDefragmentServices services, int sourceID, ISlotCopyHandler
			 command, ByteArrayBuffer sourceReader)
		{
			int targetID = services.StrictMappedID(sourceID);
			Slot targetSlot = services.AllocateTargetSlot(sourceReader.Length());
			services.Mapping().MapId(targetID, targetSlot);
			Db4objects.Db4o.Internal.DefragmentContextImpl context = new Db4objects.Db4o.Internal.DefragmentContextImpl
				(sourceReader, services);
			command.ProcessCopy(context);
			services.TargetWriteBytes(context, targetSlot.Address());
		}
예제 #18
0
		private static byte[] BytesToSendFor(string message)
		{
			LatinStringIO io = new LatinStringIO();
			int marshalledStringLength = io.Length(message);
			ByteArrayBuffer buffer = new ByteArrayBuffer(marshalledStringLength + Const4.IntLength);

			buffer.WriteInt(marshalledStringLength);

			io.WriteLengthAndString(buffer, message);
			buffer.Seek(0);
			return buffer.ReadBytes(buffer.Length());
		}
예제 #19
0
파일: MReadBytes.cs 프로젝트: erdincay/db4o
		public virtual Msg GetWriter(Transaction trans, ByteArrayBuffer bytes)
		{
			MsgD msg = GetWriterForLength(trans, bytes.Length());
			msg._payLoad.Append(bytes._buffer);
			return msg;
		}
예제 #20
0
 public void Decrypt(ByteArrayBuffer reader)
 {
     if (i_encrypt)
     {
         var encryptorOffSet = i_lastEncryptorByte;
         var bytes = reader._buffer;
         for (var i = reader.Length() - 1; i >= 0; i--)
         {
             bytes[i] += i_encryptor[encryptorOffSet];
             if (encryptorOffSet == 0)
             {
                 encryptorOffSet = i_lastEncryptorByte;
             }
             else
             {
                 encryptorOffSet--;
             }
         }
     }
 }