- private static NormalizedNodeDataInput streamReader(final DataInput in) throws IOException {
- NormalizedNodeDataInput streamReader = REUSABLE_READER_TL.get();
- if (streamReader == null) {
- streamReader = NormalizedNodeInputOutput.newDataInput(in);
- }
-
- return streamReader;
- }
-
- public static <T> void deserializePathAndNode(final DataInput in, final T instance, final Applier<T> applier) {
- try {
- NormalizedNodeDataInput streamReader = streamReader(in);
- NormalizedNode<?, ?> node = streamReader.readNormalizedNode();
- YangInstanceIdentifier path = streamReader.readYangInstanceIdentifier();
- applier.apply(instance, path, node);
- } catch (IOException e) {
- throw new IllegalArgumentException("Error deserializing path and Node", e);
+ public static Optional<NormalizedNode<?, ?>> readNormalizedNode(final DataInput in) throws IOException {
+ if (!in.readBoolean()) {
+ return Optional.empty();