/** * Encodes this <code>PolicyReference</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 encoded = indenter.makeString(); if (policyType == POLICY_REFERENCE) { out.println(encoded + "<PolicyIdReference" + encodeConstraints() + ">" + reference.toString() + "</PolicyIdReference>"); } else { out.println(encoded + "<PolicySetIdReference" + encodeConstraints() + ">" + reference.toString() + "</PolicySetIdReference>"); } }