+ return node;
+ }
+
+ public static byte [] serializeNormalizedNode(NormalizedNode<?, ?> node) {
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ serializeNormalizedNode(node, new DataOutputStream(bos));
+ return bos.toByteArray();
+ }
+
+ public static void serializePath(YangInstanceIdentifier path, DataOutput out) {
+ Preconditions.checkNotNull(path);
+ try {
+ NormalizedNodeDataOutput streamWriter = streamWriter(out);
+ streamWriter.writeYangInstanceIdentifier(path);
+ } catch (IOException e) {
+ throw new IllegalArgumentException(String.format("Error serializing path %s", path), e);
+ }
+ }
+
+ public static YangInstanceIdentifier deserializePath(DataInput in) {
+ try {
+ NormalizedNodeDataInput streamReader = streamReader(in);
+ return streamReader.readYangInstanceIdentifier();
+ } catch (IOException e) {
+ throw new IllegalArgumentException("Error deserializing path", e);
+ }