# File lib/kirbybase.rb, line 3560
    def rebuild(fptr)
        @idx_hash.clear

        encrypted = @table.encrypted?

        begin
            # Skip header rec.

            fptr.readline

            # Loop through table.

            while true
                # Record current position in table.  Then read first

                # detail record.

                fpos = fptr.tell
                line = fptr.readline

                line = unencrypt_str(line) if encrypted
                line.strip!

                # If blank line (i.e. 'deleted'), skip it.

                next if line == ''

                # Split the line up into fields.

                rec = line.split('|', 2)

                @idx_hash[rec.first.to_i] = fpos
            end
        # Here's how we break out of the loop...

        rescue EOFError
        end
    end