DefaultStyledDocument.ElementSpec[] elements; elements = new DefaultStyledDocument.ElementSpec[parseBuffer.size()]; parseBuffer.copyInto(elements); parseBuffer.removeAllElements(); if (offset == 0) create(elements); else insert(offset, elements);  offset += HTMLDocument.this.getLength() - offset;
flushImpl();
    public void flush() throws BadLocationException    {      DefaultStyledDocument.ElementSpec[] elements;      elements = new DefaultStyledDocument.ElementSpec[parseBuffer.size()];      parseBuffer.copyInto(elements);      parseBuffer.removeAllElements();      if (offset == 0)        create(elements);      else      insert(offset, elements);      offset += HTMLDocument.this.getLength() - offset;    }