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 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;
19 * Lithium (or Oxygen really) specialization of AbstractLithiumDataInput.
21 final class LithiumNormalizedNodeInputStreamReader extends AbstractLithiumDataInput {
22 LithiumNormalizedNodeInputStreamReader(final DataInput input) {
27 public NormalizedNodeStreamVersion getVersion() {
28 return NormalizedNodeStreamVersion.LITHIUM;
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());
38 return QNameFactory.create(localName, namespace, revision);
42 AugmentationIdentifier readAugmentationIdentifier() throws IOException {
43 return defaultReadAugmentationIdentifier();
47 NodeIdentifier readNodeIdentifier() throws IOException {
48 return new NodeIdentifier(readQName());