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.yangtools.yang.data.codec.binfmt;
10 import com.google.common.base.Strings;
11 import java.io.DataInput;
12 import java.io.IOException;
13 import org.opendaylight.yangtools.yang.common.QName;
14 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
15 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
18 * Lithium (or Oxygen really) specialization of AbstractLithiumDataInput.
20 final class LithiumNormalizedNodeInputStreamReader extends AbstractLithiumDataInput {
21 LithiumNormalizedNodeInputStreamReader(final DataInput input) {
26 public NormalizedNodeStreamVersion getVersion() {
27 return NormalizedNodeStreamVersion.LITHIUM;
31 public QName readQName() throws IOException {
32 // Read in the same sequence of writing
33 String localName = readCodedString();
34 String namespace = readCodedString();
35 String revision = Strings.emptyToNull(readCodedString());
37 return QNameFactory.create(localName, namespace, revision);
41 AugmentationIdentifier readAugmentationIdentifier() throws IOException {
42 return defaultReadAugmentationIdentifier();
46 NodeIdentifier readNodeIdentifier() throws IOException {
47 return new NodeIdentifier(readQName());