Class StreamBuilder

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.Appendable, java.lang.AutoCloseable, NamedItem, StreamWriter

    public class StreamBuilder
    extends AbstractStreamWriter
    StreamBuilder is a special implementation of the StreamWriter interface that can be used to create Feed Object Model instances using the StreamWriter interface. StreamBuilder provides an additional method (getBase) for returning the FOM Base element that was built. The StreamWriter methods indent(), flush(), close(), setWriter(), setInputStream, setAutoclose(), setAutoflush(), setAutoIndent(), and setChannel() have no effect on this StreamWriter implementation
     StreamBuilder sw = new StreamBuilder();
     Entry entry =
         sw.startElement(Constants.ENTRY).writeBase("http://example.org").writeLanguage("en-US")
             .writeId("http://example.org").writeTitle("testing").writeUpdated(new Date()).endElement().getBase();
     entry.writeTo(System.out);