コード例 #1
0
        private byte[] readblockdata(AllocationBlock ab)
        {
            byte[] data   = new byte[ab.datalength];
            long   offset = 0;
            int    len    = ab.datalength;
            int    dbsize = _BlockSize - _blockheader.Length - ab.keylen;

            ab.Blocks.ForEach(x =>
            {
                byte[] b = _datastore.ReadBlock(x);
                int c    = len;
                if (c > dbsize)
                {
                    c = dbsize;
                }
                Buffer.BlockCopy(b, _blockheader.Length + ab.keylen, data, (int)offset, c);
                offset += c;
                len    -= c;
            });
            if (ab.isCompressed)
            {
                data = MiniLZO.Decompress(data);
            }
            return(data);
        }
コード例 #2
0
        internal byte[] ReadBytes(long recnum, out StorageItem <T> meta)
        {
            meta = null;
            if (recnum >= _lastRecordNum)
            {
                return(null);
            }
            lock (_readlock)
            {
                long       off  = ComputeOffset(recnum);
                FileStream fs   = GetReadFileStreamWithSeek(off);
                byte[]     data = internalReadBytes(fs, out meta);

                if (meta.isCompressed > 0)
                {
                    data = MiniLZO.Decompress(data);
                }

                return(data);
            }
        }