code: public void dumpTo(OutputStream out)
      {
          PrintWriter writer;
          try {
              writer = new PrintWriter(new OutputStreamWriter(out, "utf-8"));
          } catch (UnsupportedEncodingException e) {
              writer = new PrintWriter(out);
          }
          recursiveDump(root, 0, writer);
          writer.close();
      }
docs: Formats the complete tag tree to an output stream.
  @param out The output stream to be used for the output.