'Write out the xref table.'

def writeXref(self):

    self.startxref = (self.fh.tell() - self.tell_base)
    self.write((u'xref\n0    %d\n' % self.nextObject).encode(u'ascii'))
    i = 0
    borken = False
    for (offset, generation, name) in self.xrefTable:
        if (offset is None):
            print((u'No    offset    for    object    %d    (%s)' % (i, name)), file=sys.stderr)
            borken = True
        else:
            if (name == u'the    zero    object'):
                key = u'f'
            else:
                key = u'n'
            text = (u'%010d    %05d    %s    \n' % (offset, generation, key))
            self.write(text.encode(u'ascii'))
        i += 1
    if borken:
        raise AssertionError(u'Indirect    object    does    not    exist')
