示例#1
0
        public FileContentBuffer(Context context, RegularInode inode, MetadataRef inodeRef)
        {
            _context = context;
            _inode = inode;

            context.InodeReader.SetPosition(inodeRef);
            context.InodeReader.Skip(_inode.Size);

            int numBlocks = (int)(_inode.FileSize / _context.SuperBlock.BlockSize);
            if (_inode.FileSize % _context.SuperBlock.BlockSize != 0 && _inode.FragmentKey == InvalidFragmentKey)
            {
                ++numBlocks;
            }

            byte[] lengthData = new byte[numBlocks * 4];
            context.InodeReader.Read(lengthData, 0, lengthData.Length);

            _blockLengths = new int[numBlocks];
            for (int i = 0; i < numBlocks; ++i)
            {
                _blockLengths[i] = Utilities.ToInt32LittleEndian(lengthData, i * 4);
            }
        }
示例#2
0
 public File(Context context, Inode inode, MetadataRef inodeRef)
 {
     _context = context;
     _inode = inode;
     _inodeRef = inodeRef;
 }
示例#3
0
 public MetablockReader(Context context, long start)
 {
     _context = context;
     _start = start;
 }