public DefragmentContextImpl(ByteArrayBuffer source, IDefragmentServices services
                              , ObjectHeader header)
 {
     _source   = source;
     _services = services;
     _target   = new ByteArrayBuffer(Length());
     _source.CopyTo(_target, 0, 0, Length());
     _objectHeader = header;
 }
Esempio n. 2
0
		public DefragmentContextImpl(ByteArrayBuffer source, IDefragmentServices services
			, ObjectHeader header)
		{
			_source = source;
			_services = services;
			_target = new ByteArrayBuffer(Length());
			_source.CopyTo(_target, 0, 0, Length());
			_objectHeader = header;
		}
Esempio n. 3
0
        private void Resize(int sizeNeeded)
        {
            int newSize = _delegate.Length() * 2;

            if (newSize - _lastOffSet < sizeNeeded)
            {
                newSize += sizeNeeded;
            }
            ByteArrayBuffer temp = new ByteArrayBuffer(newSize);

            temp.Seek(_lastOffSet);
            _delegate.CopyTo(temp, 0, 0, _delegate.Length());
            _delegate = temp;
        }
Esempio n. 4
0
		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());
			}
		}