{ String insertString = new String(spec.getArray(), spec.getOffset(),
contentBuffer.append(spec.getArray(), spec.getOffset(),
  protected void insert(int offset, ElementSpec[] data)    throws BadLocationException  {    writeLock();    // First we insert the content.    int index = offset;    for (int i = 0; i < data.length; i++)      {        ElementSpec spec = data[i];        if (spec.getArray() != null && spec.getLength() > 0)          {            String insertString = new String(spec.getArray(), spec.getOffset(),                                             spec.getLength());            content.insertString(index, insertString);          }        index += spec.getLength();      }    // Update the view structure.    DefaultDocumentEvent ev = new DefaultDocumentEvent(offset, index - offset,                                               DocumentEvent.EventType.INSERT);    for (int i = 0; i < data.length; i++)      {        ElementSpec spec = data[i];        AttributeSet atts = spec.getAttributes();        if (atts != null)          insertUpdate(ev, atts);      }    // Finally we must update the document structure and fire the insert update    // event.    buffer.insert(offset, index - offset, data, ev);    if (ev.modified)    fireInsertUpdate(ev);    writeUnlock();  }