com.google.cloud.dataflow.sdk.io

## Class XmlSink.XmlWriter<T>

- java.lang.Object
- - com.google.cloud.dataflow.sdk.io.Sink.Writer<T,FileBasedSink.FileResult>
  - - com.google.cloud.dataflow.sdk.io.FileBasedSink.FileBasedWriter<T>
    - - com.google.cloud.dataflow.sdk.io.XmlSink.XmlWriter<T>

Enclosing class:
  XmlSink

    protected static final class XmlSink.XmlWriter<T>
    extends FileBasedSink.FileBasedWriter<T>

A `Sink.Writer` that can write objects as XML elements.

### Field Summary

### Fields inherited from class com.google.cloud.dataflow.sdk.io.FileBasedSink.FileBasedWriter

`mimeType`

### Constructor Summary

Constructors
Constructor and Description
`XmlWriter(XmlSink.XmlWriteOperation<T> writeOperation, Marshaller marshaller)`

### Method Summary

All Methods Instance Methods Concrete Methods
`XmlSink.XmlWriteOperation<T>` `getWriteOperation()` Return the XmlWriteOperation this write belongs to.
`protected void` `prepareWrite(WritableByteChannel channel)` Creates the output stream that elements will be written to.
`void` `write(T value)` Writes a value to the stream.
`protected void` `writeFooter()` Writes the root element closing tag.
`protected void` `writeHeader()` Writes the root element opening tag.

### Methods inherited from class com.google.cloud.dataflow.sdk.io.FileBasedSink.FileBasedWriter

`close, open`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### XmlWriter

    public XmlWriter(XmlSink.XmlWriteOperation<T> writeOperation,
                     Marshaller marshaller)

### Method Detail

#### prepareWrite

    protected void prepareWrite(WritableByteChannel channel)
                         throws Exception

Creates the output stream that elements will be written to.

Specified by:
  `prepareWrite` in class `FileBasedSink.FileBasedWriter<T>`
Throws:
  `Exception`

#### writeHeader

    protected void writeHeader()
                        throws Exception

Writes the root element opening tag.

Overrides:
  `writeHeader` in class `FileBasedSink.FileBasedWriter<T>`
Throws:
  `Exception`

#### writeFooter

    protected void writeFooter()
                        throws Exception

Writes the root element closing tag.

Overrides:
  `writeFooter` in class `FileBasedSink.FileBasedWriter<T>`
Throws:
  `Exception`

#### write

    public void write(T value)
               throws Exception

Writes a value to the stream.

Specified by:
  `write` in class `Sink.Writer<T,FileBasedSink.FileResult>`
Throws:
  `Exception`

#### getWriteOperation

    public XmlSink.XmlWriteOperation<T> getWriteOperation()

Return the XmlWriteOperation this write belongs to.

Overrides:
  `getWriteOperation` in class `FileBasedSink.FileBasedWriter<T>`