2 * Copyright (c) 2014, 2015 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.cluster.datastore.node.utils.stream;
10 import java.io.DataOutput;
11 import java.io.IOException;
12 import org.opendaylight.yangtools.yang.common.QName;
13 import org.opendaylight.yangtools.yang.common.QNameModule;
14 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
17 * NormalizedNodeOutputStreamWriter will be used by distributed datastore to send normalized node in
19 * A stream writer wrapper around this class will write node objects to stream in recursive manner.
20 * for example - If you have a ContainerNode which has a two LeafNode as children, then
22 * {@link #startContainerNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier, int)},
24 * {@link #leafNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier, Object)} twice
25 * and then, {@link #endNode()} to end container node.
27 * <p>Based on the each node, the node type is also written to the stream, that helps in reconstructing the object,
30 final class LithiumNormalizedNodeOutputStreamWriter extends AbstractLithiumDataOutput {
31 LithiumNormalizedNodeOutputStreamWriter(final DataOutput output) {
36 short streamVersion() {
37 return TokenTypes.LITHIUM_VERSION;
41 void writeQNameInternal(final QName qname) throws IOException {
42 defaultWriteQName(qname);
46 void writeModule(final QNameModule module) throws IOException {
47 defaultWriteModule(module);
51 void writeAugmentationIdentifier(final AugmentationIdentifier aid) throws IOException {
52 defaultWriteAugmentationIdentifier(aid);