- public static YangInstanceIdentifier deserializePath(DataInput in) {
- try {
- NormalizedNodeDataInput streamReader = streamReader(in);
- return streamReader.readYangInstanceIdentifier();
- } catch (IOException e) {
- throw new IllegalArgumentException("Error deserializing path", e);
+ public static <T> void readPathAndNode(final DataInput in, final T instance, final Applier<T> applier)
+ throws IOException {
+ final NormalizedNodeDataInput stream = NormalizedNodeInputOutput.newDataInput(in);
+ YangInstanceIdentifier path = stream.readYangInstanceIdentifier();
+ NormalizedNode<?, ?> node = stream.readNormalizedNode();
+ applier.apply(instance, path, node);
+ }
+
+ public static void writePathAndNode(final DataOutput out, final YangInstanceIdentifier path,
+ final NormalizedNode<?, ?> node) throws IOException {
+ try (NormalizedNodeDataOutput stream = NormalizedNodeInputOutput.newDataOutput(out)) {
+ stream.writeYangInstanceIdentifier(path);
+ stream.writeNormalizedNode(node);