Deveel.Data.Store.ObjectStore.GetObject C# (CSharp) Method

GetObject() public method

public GetObject ( ObjectId id ) : ILargeObject
id ObjectId
return ILargeObject
        public ILargeObject GetObject(ObjectId id)
        {
            long objOffset;
            long maxSize;
            long currentSize;
            lock (fixedList) {
                if (id.StoreId != Id)
                    throw new InvalidObjectIdException(id);

                var refId = id.Id;
                // Assert that the blob reference id given is a valid range
                if (refId < 0 || refId >= fixedList.NodeCount)
                    throw new InvalidObjectIdException(id);

                // Position on this record
                IArea block = fixedList.GetRecord(refId);
                // Read the information in the fixed record
                int status = block.ReadInt4();
                // Assert that the status is not deleted
                if ((status & DeletedFlag) != 0)
                    throw new InvalidOperationException("Assertion failed: record is deleted!");

                // Get the reference count
                int refCount = block.ReadInt4();
                // Get the total size of the blob
                maxSize = block.ReadInt8();
                // Get the current running size
                currentSize = block.ReadInt8();
                // Get the blob pointer
                objOffset = block.ReadInt8();
            }

            IArea area = store.GetArea(objOffset);
            area.Position = 0;
            area.ReadInt4();  // (reserved)
            // Read the type
            int type = area.ReadInt4();
            // The size of the block
            long blockSize = area.ReadInt8();
            // The number of pages in the blob
            long pageCount = area.ReadInt8();

            bool compressed = (type & CompressedFlag) != 0;
            return new LargeObject(this, id.Id, maxSize, currentSize, compressed, true);
        }