public static AutoCloseableXMLStreamWriter writer(
		final OutputStream output,
		final String indent
	)
		throws XMLStreamException
	{
		requireNonNull(output);

		final XMLOutputFactory factory = XMLOutputFactory.newFactory();
		return indent != null
			? new IndentingXMLWriter(
				factory.createXMLStreamWriter(output, "UTF-8"), indent)
			: new XMLWriterProxy(
				factory.createXMLStreamWriter(output, "UTF-8"));
	}
Create a new {@code XMLStreamWriter} from the given output stream.
<em>
The caller is responsible for closing the returned {@code XMLStreamWriter}.
</em>

{@snippet lang="java":
try (AutoCloseableXMLStreamWriter xml = XML.writer(out, "    ")) {
    writer.write(value, xml);
}
}

@param output the underlying output stream
@param indent the element indent used for the XML output
@return a new {@code XMLStreamWriter} instance
@throws XMLStreamException if an error occurs while creating the XML
        stream writer
@throws NullPointerException if the given {@code output} stream is
        {@code null}
jenetics.xml/src/main/java/io/jenetics/xml/stream/XML.java