Exemplo n.º 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);
            }
        }
Exemplo n.º 2
0
 public File(Context context, Inode inode, MetadataRef inodeRef)
 {
     _context = context;
     _inode = inode;
     _inodeRef = inodeRef;
 }
Exemplo n.º 3
0
 internal long DistanceFrom(MetadataRef startPos)
 {
     return ((_currentBlockNum - startPos.Block) * VfsSquashFileSystemReader.MetadataBufferSize)
         + (_currentOffset - startPos.Offset);
 }
Exemplo n.º 4
0
 public void SetPosition(MetadataRef position)
 {
     SetPosition(position.Block, position.Offset);
 }