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;
16 * NormalizedNodeOutputStreamWriter will be used by distributed datastore to send normalized node in
18 * A stream writer wrapper around this class will write node objects to stream in recursive manner.
19 * for example - If you have a ContainerNode which has a two LeafNode as children, then
21 * {@link #startContainerNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier, int)},
23 * {@link #leafNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier, Object)} twice
24 * and then, {@link #endNode()} to end container node.
26 * <p>Based on the each node, the node type is also written to the stream, that helps in reconstructing the object,
29 final class LithiumNormalizedNodeOutputStreamWriter extends AbstractLithiumDataOutput {
30 LithiumNormalizedNodeOutputStreamWriter(final DataOutput output) {
35 protected short streamVersion() {
36 return TokenTypes.LITHIUM_VERSION;
40 public void writeQName(final QName qname) throws IOException {
41 defaultWriteQName(qname);
45 void writeModule(final QNameModule module) throws IOException {
46 defaultWriteModule(module);