/** * Encodes this <code>TargetMatch</code> into its XML representation and * writes this encoding to the given <code>OutputStream</code> with no * indentation. * * @param output a stream into which the XML-encoded data is written */ public void encode(OutputStream output) { encode(output, new Indenter(0)); }
/** * Encodes this <code>TargetMatchGroup</code> into its XML representation * and writes this encoding to the given <code>OutputStream</code> with * indentation. * * @param output a stream into which the XML-encoded data is written * @param indenter an object that creates indentation strings */ public void encode(OutputStream output, Indenter indenter) { PrintStream out = new PrintStream(output); String indent = indenter.makeString(); Iterator it = matches.iterator(); String name = TargetMatch.NAMES[matchType]; out.println(indent + "<" + name + ">"); indenter.in(); while (it.hasNext()) { TargetMatch tm = (TargetMatch)(it.next()); tm.encode(output, indenter); } out.println(indent + "</" + name + ">"); indenter.out(); }