*/
package org.opendaylight.yangtools.yang.data.api.schema.stream;
+import java.io.Closeable;
+import java.io.Flushable;
+import java.io.IOException;
+
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
* and finished using {@link #endNode()}.</li>
*
* <li><code>UnkeyedList</code> - Unkeyed list represent list without keys,
- * unkeyed list start is emmited using {@link #startUnkeyedList(NodeIdentifier, int)} list
- * end is emmited using {@link #endNode()}. Each list item is emmited using
+ * unkeyed list start is emitted using {@link #startUnkeyedList(NodeIdentifier, int)} list
+ * end is emitted using {@link #endNode()}. Each list item is emitted using
* {@link #startUnkeyedListItem(NodeIdentifier, int)} and ended using {@link #endNode()}.</li>
* </ul>
*
* <li><code>leaf</code> - Leaf node event is emitted using
- * {@link #leafNode(NodeIdentifier, Object)}. {@link #endNode()} MUST NOT BE emmited for
+ * {@link #leafNode(NodeIdentifier, Object)}. {@link #endNode()} MUST NOT BE emitted for
* leaf node.</li>
*
* <li><code>leaf-list</code> - Leaf list start is emitted using
* {@link #leafSetEntryNode(Object).
*
* <li><code>anyxml - Anyxml node event is emitted using
- * {@link #leafNode(NodeIdentifier, Object)}. {@link #endNode()} MUST NOT BE emmited
+ * {@link #leafNode(NodeIdentifier, Object)}. {@link #endNode()} MUST NOT BE emitted
* for anyxml node.</code></li>
*
*
* and resources needlessly.
*
*/
-public interface NormalizedNodeStreamWriter {
+public interface NormalizedNodeStreamWriter extends Closeable, Flushable {
/**
* Methods in this interface allow users to hint the underlying
- * implementation about the sizing of container-like constructurs
+ * implementation about the sizing of container-like constructors
* (leafLists, containers, etc.). These hints may be taken into account by a
* particular implementation to improve performance, but clients are not
* required to provide hints. This constant should be used by clients who
* @throws IllegalStateException
* If node was emitted inside <code>map</code>,
* <code>choice</code> <code>unkeyed list</code> node.
+ * @throws IOException if an underlying IO error occurs
*/
- void leafNode(NodeIdentifier name, Object value) throws IllegalArgumentException;
+ void leafNode(NodeIdentifier name, Object value) throws IOException, IllegalArgumentException;
/**
*
* @throws IllegalStateException
* If node was emitted inside <code>map</code>,
* <code>choice</code> <code>unkeyed list</code> node.
+ * @throws IOException if an underlying IO error occurs
*/
- void startLeafSet(NodeIdentifier name, int childSizeHint) throws IllegalArgumentException;
+ void startLeafSet(NodeIdentifier name, int childSizeHint) throws IOException, IllegalArgumentException;
/**
* Emits a leaf set entry node
* If emitted leaf node has invalid value.
* @throws IllegalStateException
* If node was emitted outside <code>leaf set</code> node.
+ * @throws IOException if an underlying IO error occurs
*/
- void leafSetEntryNode(Object value) throws IllegalArgumentException;
+ void leafSetEntryNode(Object value) throws IOException, IllegalArgumentException;
/**
*
* <li>{@link #startLeafSet(NodeIdentifier, int)}</li>
* <li>{@link #startMapNode(NodeIdentifier, int)}</li>
* <li>{@link #startUnkeyedList(NodeIdentifier, int)}</li>
- * <li>{@link #startAugmentationNode(AugmentationIdentifier)}</li>
- * </ul>
+ * <li>{@link #startAugmentationNode(AugmentationIdentifier)}</li>
+ * </ul>
*
* @param name
* name of node as defined in schema, namespace and revision are
* @throws IllegalStateException
* If node was emitted inside <code>map</code>,
* <code>choice</code> <code>unkeyed list</code> node.
+ * @throws IOException if an underlying IO error occurs
*/
- void startContainerNode(NodeIdentifier name, int childSizeHint) throws IllegalArgumentException;
+ void startContainerNode(NodeIdentifier name, int childSizeHint) throws IOException, IllegalArgumentException;
/**
*
* @throws IllegalStateException
* If node was emitted inside <code>map</code>,
* <code>choice</code> <code>unkeyed list</code> node.
+ * @throws IOException if an underlying IO error occurs
*/
- void startUnkeyedList(NodeIdentifier name, int childSizeHint) throws IllegalArgumentException;
+ void startUnkeyedList(NodeIdentifier name, int childSizeHint) throws IOException, IllegalArgumentException;
/**
* Emits start of new unkeyed list item.
* events than count.
* @throws IllegalStateException
* If node was emitted outside <code>unkeyed list</code> node.
+ * @throws IOException if an underlying IO error occurs
*/
- void startUnkeyedListItem(NodeIdentifier name, int childSizeHint) throws IllegalStateException;
+ void startUnkeyedListItem(NodeIdentifier name, int childSizeHint) throws IOException, IllegalStateException;
/**
*
* @throws IllegalStateException
* If node was emitted inside <code>map</code>,
* <code>choice</code> <code>unkeyed list</code> node.
+ * @throws IOException if an underlying IO error occurs
*/
- void startMapNode(NodeIdentifier name, int childSizeHint) throws IllegalArgumentException;
+ void startMapNode(NodeIdentifier name, int childSizeHint) throws IOException, IllegalArgumentException;
/**
*
* If key contains incorrect value.
* @throws IllegalStateException
* If node was emitted outside <code>map entry</code> node.
+ * @throws IOException if an underlying IO error occurs
*/
- void startMapEntryNode(NodeIdentifierWithPredicates identifier, int childSizeHint) throws IllegalArgumentException;
+ void startMapEntryNode(NodeIdentifierWithPredicates identifier, int childSizeHint) throws IOException, IllegalArgumentException;
/**
*
* @throws IllegalStateException
* If node was emitted inside <code>map</code>,
* <code>choice</code> <code>unkeyed list</code> node.
+ * @throws IOException if an underlying IO error occurs
*/
- void startOrderedMapNode(NodeIdentifier name, int childSizeHint) throws IllegalArgumentException;
+ void startOrderedMapNode(NodeIdentifier name, int childSizeHint) throws IOException, IllegalArgumentException;
/**
*
* @throws IllegalStateException
* If node was emitted inside <code>map</code>,
* <code>choice</code> <code>unkeyed list</code> node.
+ * @throws IOException if an underlying IO error occurs
*/
- void startChoiceNode(NodeIdentifier name, int childSizeHint) throws IllegalArgumentException;
+ void startChoiceNode(NodeIdentifier name, int childSizeHint) throws IOException, IllegalArgumentException;
/**
* Emits start of augmentation node.
* Augmentation identifier
* @throws IllegalArgumentException
* If augmentation is invalid in current context.
+ * @throws IOException if an underlying IO error occurs
*/
- void startAugmentationNode(AugmentationIdentifier identifier) throws IllegalArgumentException;
+ void startAugmentationNode(AugmentationIdentifier identifier) throws IOException, IllegalArgumentException;
/**
* Emits anyxml node event.
*
- *
* @param name
* @param value
* @throws IllegalArgumentException
* @throws IllegalStateException
* If node was emitted inside <code>map</code>,
* <code>choice</code> <code>unkeyed list</code> node.
+ * @throws IOException if an underlying IO error occurs
*/
- void anyxmlNode(NodeIdentifier name, Object value) throws IllegalArgumentException;
+ void anyxmlNode(NodeIdentifier name, Object value) throws IOException, IllegalArgumentException;
/**
* Emits end event for node.
*
- * @throws IllegalStateException If there is no start* event to be closed.B
- *
+ * @throws IllegalStateException If there is no start* event to be closed.
+ * @throws IOException if an underlying IO error occurs
*/
- void endNode() throws IllegalStateException;
+ void endNode() throws IOException, IllegalStateException;
+
+ @Override
+ void close() throws IOException;
+ @Override
+ void flush() throws IOException;
}