public interface NodeWriter extends Closeable
Factory
.
Client needs to make sure the close()
method is always called, so that the serialization can complete and temporary resources can be
disposed.
This interface is not intended to be implemented by clients.
NodeContentProducer
,
NodeWriter.Factory.XML
,
NodeWriter.Factory.JSON
Modifier and Type | Interface and Description |
---|---|
static interface |
NodeWriter.Factory
A factory to instantiate a node writer.
|
Modifier and Type | Method and Description |
---|---|
NodeWriter |
endArray()
Ends the current array node production.
|
NodeWriter |
endDocument()
Finalizes the production of the node tree.
|
NodeWriter |
endNode()
Ends the current node production.
|
NodeWriter |
startArray(String name)
Starts a new array node production.
|
NodeWriter |
startDocument(String name)
Start the production of the node tree.
|
NodeWriter |
startNode()
Starts a new node production, child of the current node which is expected to be an array node.
|
NodeWriter |
startNode(String name)
Starts a new node production with the specified name.
|
NodeWriter |
write(String name,
String value)
Writes a name/value pair on the current node.
|
NodeWriter startDocument(String name) throws IOException
name
- the name of the root node. This name is not used by the JSON implementation.IOException
- if anything prevents the writing process.NodeWriter endDocument() throws IOException
IOException
- if anything prevents the writing process.NodeWriter startNode() throws IOException
IOException
- if anything prevents the writing process.startArray(String)
NodeWriter startNode(String name) throws IOException
name
- the node name.IOException
- if anything prevents the writing process.NodeWriter endNode() throws IOException
IOException
- if anything prevents the writing process.NodeWriter startArray(String name) throws IOException
startNode()
method for each item of the array.name
- the node name.IOException
- if anything prevents the writing process.startNode()
NodeWriter endArray() throws IOException
IOException
- if anything prevents the writing process.NodeWriter write(String name, String value) throws IOException
name
- the attribute name.value
- the attribute value.IOException
- if anything prevents the writing process.