Beispiel #1
0
        private XArray ReadIndices(ArraySelector selector)
        {
            Allocator.AllocateToSize(ref _resultArray, selector.Count);

            // Read all string positions
            XArray positions = _positionsReader.Read(ArraySelector.All(_positionsReader.Count));

            int[] positionArray = (int[])positions.Array;

            // Read all raw string bytes
            XArray bytes = _bytesReader.Read(ArraySelector.All(_bytesReader.Count));

            byte[] textArray = (byte[])bytes.Array;

            // Update the String8 array to point to them
            for (int i = 0; i < selector.Count; ++i)
            {
                int rowIndex   = selector.Index(i);
                int valueStart = (rowIndex == 0 ? 0 : positionArray[rowIndex - 1]);
                int valueEnd   = positionArray[rowIndex];
                _resultArray[i] = new String8(textArray, valueStart, valueEnd - valueStart);
            }

            // Cache the xarray and return it
            _currentArray    = XArray.All(_resultArray, selector.Count);
            _currentSelector = selector;
            return(_currentArray);
        }