/**
   * Output the text of the indicated Element, properly clipping it to the range of the Document
   * specified when the AbstractWriter was created.
   */
  protected void text(Element elt) throws BadLocationException, IOException {
    int eltStart = elt.getStartOffset();
    int eltEnd = elt.getEndOffset();

    eltStart = Math.max(eltStart, startOffset);
    eltEnd = Math.min(eltEnd, endOffset);
    write(document.getText(eltStart, eltEnd));
  }
 /** Print the given AttributeSet as a sequence of assignment-like strings, e.g. "key=value". */
 protected void writeAttributes(AttributeSet attrs) throws IOException {
   Enumeration e = attrs.getAttributeNames();
   while (e.hasMoreElements()) {
     Object name = e.nextElement();
     Object val = attrs.getAttribute(name);
     write(name + "=" + val);
     writeLineSeparator();
   }
 }
 /**
  * Indent this line by emitting spaces, according to the current indent level and the current
  * number of spaces per indent. After this method is called, the current line is no longer
  * considered to be empty, even if no spaces are actually written.
  */
 protected void indent() throws IOException {
   int spaces = indentLevel * indentSpace;
   if (spaces > 0) {
     char[] v = new char[spaces];
     Arrays.fill(v, ' ');
     write(v, 0, v.length);
   }
   indented = true;
 }
 /** Write a String. */
 protected void write(String s) throws IOException {
   char[] v = s.toCharArray();
   write(v, 0, v.length);
 }
 /** Write a single character. */
 protected void write(char ch) throws IOException {
   write(new char[] {ch}, 0, 1);
 }