Switch default stream output to Magnesium
[controller.git] / opendaylight / md-sal / sal-clustering-commons / src / main / java / org / opendaylight / controller / cluster / datastore / node / utils / stream / LithiumNormalizedNodeInputStreamReader.java
1 /*
2  * Copyright (c) 2014, 2015 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.controller.cluster.datastore.node.utils.stream;
9
10 import com.google.common.base.Strings;
11 import java.io.DataInput;
12 import java.io.IOException;
13 import org.opendaylight.controller.cluster.datastore.node.utils.QNameFactory;
14 import org.opendaylight.yangtools.yang.common.QName;
15 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
16 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
17
18 /**
19  * Lithium (or Oxygen really) specialization of AbstractLithiumDataInput.
20  */
21 final class LithiumNormalizedNodeInputStreamReader extends AbstractLithiumDataInput {
22     LithiumNormalizedNodeInputStreamReader(final DataInput input) {
23         super(input);
24     }
25
26     @Override
27     public NormalizedNodeStreamVersion getVersion() {
28         return NormalizedNodeStreamVersion.LITHIUM;
29     }
30
31     @Override
32     public QName readQName() throws IOException {
33         // Read in the same sequence of writing
34         String localName = readCodedString();
35         String namespace = readCodedString();
36         String revision = Strings.emptyToNull(readCodedString());
37
38         return QNameFactory.create(localName, namespace, revision);
39     }
40
41     @Override
42     AugmentationIdentifier readAugmentationIdentifier() throws IOException {
43         return defaultReadAugmentationIdentifier();
44     }
45
46     @Override
47     NodeIdentifier readNodeIdentifier() throws IOException {
48         return new NodeIdentifier(readQName());
49     }
50 }