- public NormalizedNodeOutputStreamWriter(OutputStream stream) throws IOException {
- Preconditions.checkNotNull(stream);
- writer = new DataOutputStream(stream);
- }
-
- @Override
- public void leafNode(YangInstanceIdentifier.NodeIdentifier name, Object value) throws IOException, IllegalArgumentException {
- Preconditions.checkNotNull(name, "Node identifier should not be null");
- LOG.debug("Writing a new leaf node");
- startNode(name.getNodeType(), NodeTypes.LEAF_NODE);
-
- writeObject(value);
- }
-
- @Override
- public void startLeafSet(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint) throws IOException, IllegalArgumentException {
- Preconditions.checkNotNull(name, "Node identifier should not be null");
- LOG.debug("Starting a new leaf set");
-
- startNode(name.getNodeType(), NodeTypes.LEAF_SET);
- }
-
- @Override
- public void leafSetEntryNode(Object value) throws IOException, IllegalArgumentException {
- LOG.debug("Writing a new leaf set entry node");
-
- writer.writeByte(NodeTypes.LEAF_SET_ENTRY_NODE);
- writeObject(value);
- }
-
- @Override
- public void startContainerNode(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint) throws IOException, IllegalArgumentException {
- Preconditions.checkNotNull(name, "Node identifier should not be null");
-
- LOG.debug("Starting a new container node");
-
- startNode(name.getNodeType(), NodeTypes.CONTAINER_NODE);
- }
-
- @Override
- public void startUnkeyedList(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint) throws IOException, IllegalArgumentException {
- Preconditions.checkNotNull(name, "Node identifier should not be null");
- LOG.debug("Starting a new unkeyed list");
-
- startNode(name.getNodeType(), NodeTypes.UNKEYED_LIST);
- }
-
- @Override
- public void startUnkeyedListItem(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint) throws IOException, IllegalStateException {
- Preconditions.checkNotNull(name, "Node identifier should not be null");
- LOG.debug("Starting a new unkeyed list item");
-
- startNode(name.getNodeType(), NodeTypes.UNKEYED_LIST_ITEM);
- }
-
- @Override
- public void startMapNode(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint) throws IOException, IllegalArgumentException {
- Preconditions.checkNotNull(name, "Node identifier should not be null");
- LOG.debug("Starting a new map node");
-
- startNode(name.getNodeType(), NodeTypes.MAP_NODE);
- }
-
- @Override
- public void startMapEntryNode(YangInstanceIdentifier.NodeIdentifierWithPredicates identifier, int childSizeHint) throws IOException, IllegalArgumentException {
- Preconditions.checkNotNull(identifier, "Node identifier should not be null");
- LOG.debug("Starting a new map entry node");
- startNode(identifier.getNodeType(), NodeTypes.MAP_ENTRY_NODE);
-
- writeKeyValueMap(identifier.getKeyValues());
-
- }
-
- @Override
- public void startOrderedMapNode(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint) throws IOException, IllegalArgumentException {
- Preconditions.checkNotNull(name, "Node identifier should not be null");
- LOG.debug("Starting a new ordered map node");
-
- startNode(name.getNodeType(), NodeTypes.ORDERED_MAP_NODE);
- }
-
- @Override
- public void startChoiceNode(YangInstanceIdentifier.NodeIdentifier name, int childSizeHint) throws IOException, IllegalArgumentException {
- Preconditions.checkNotNull(name, "Node identifier should not be null");
- LOG.debug("Starting a new choice node");
-
- startNode(name.getNodeType(), NodeTypes.CHOICE_NODE);
- }
-
- @Override
- public void startAugmentationNode(YangInstanceIdentifier.AugmentationIdentifier identifier) throws IOException, IllegalArgumentException {
- Preconditions.checkNotNull(identifier, "Node identifier should not be null");
- LOG.debug("Starting a new augmentation node");
-
- writer.writeByte(NodeTypes.AUGMENTATION_NODE);
- writeQNameSet(identifier.getPossibleChildNames());