2 * Copyright (c) 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.annotations.Beta;
11 import java.io.DataInput;
12 import java.io.DataOutput;
13 import java.io.IOException;
14 import org.eclipse.jdt.annotation.NonNull;
17 @Deprecated(forRemoval = true)
18 public final class NormalizedNodeInputOutput {
19 private NormalizedNodeInputOutput() {
20 throw new UnsupportedOperationException();
24 * Creates a new {@link NormalizedNodeDataInput} instance that reads from the given input. This method first reads
25 * and validates that the input contains a valid NormalizedNode stream.
27 * @param input the DataInput to read from
28 * @return a new {@link NormalizedNodeDataInput} instance
29 * @throws IOException if an error occurs reading from the input
31 public static NormalizedNodeDataInput newDataInput(final @NonNull DataInput input) throws IOException {
33 return new CompatNormalizedNodeDataInput(org.opendaylight.yangtools.yang.data.codec.binfmt
34 .NormalizedNodeDataInput.newDataInput(input));
35 } catch (org.opendaylight.yangtools.yang.data.codec.binfmt.InvalidNormalizedNodeStreamException e) {
36 throw new InvalidNormalizedNodeStreamException(e.getMessage(), e);
41 * Creates a new {@link NormalizedNodeDataInput} instance that reads from the given input. This method does not
42 * perform any initial validation of the input stream.
44 * @param input the DataInput to read from
45 * @return a new {@link NormalizedNodeDataInput} instance
47 public static NormalizedNodeDataInput newDataInputWithoutValidation(final @NonNull DataInput input) {
48 return new CompatNormalizedNodeDataInput(org.opendaylight.yangtools.yang.data.codec.binfmt
49 .NormalizedNodeDataInput.newDataInputWithoutValidation(input));
53 * Creates a new {@link NormalizedNodeDataOutput} instance that writes to the given output and latest current
56 * @param output the DataOutput to write to
57 * @return a new {@link NormalizedNodeDataOutput} instance
59 public static NormalizedNodeDataOutput newDataOutput(final @NonNull DataOutput output) {
60 return newDataOutput(output, NormalizedNodeStreamVersion.MAGNESIUM);
64 * Creates a new {@link NormalizedNodeDataOutput} instance that writes to the given output.
66 * @param output the DataOutput to write to
67 * @param version Streaming version to use
68 * @return a new {@link NormalizedNodeDataOutput} instance
70 public static NormalizedNodeDataOutput newDataOutput(final @NonNull DataOutput output,
71 final @NonNull NormalizedNodeStreamVersion version) {
72 return new CompatNormalizedNodeDataOutput(version.toYangtools().newDataOutput(output));