You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@daffodil.apache.org by GitBox <gi...@apache.org> on 2019/01/04 17:59:16 UTC

[GitHub] mbeckerle commented on a change in pull request #161: Make the JAPI/SAPI DataProcessors serializable

mbeckerle commented on a change in pull request #161: Make the JAPI/SAPI DataProcessors serializable
URL: https://github.com/apache/incubator-daffodil/pull/161#discussion_r245372700
 
 

 ##########
 File path: daffodil-japi/src/test/java/org/apache/daffodil/example/TestJavaAPI.java
 ##########
 @@ -59,8 +61,34 @@
         }
     }
 
+    public DataProcessor reserializeDataProcessor(DataProcessor dp) throws IOException, ClassNotFoundException {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        ObjectOutputStream oos = new ObjectOutputStream(baos);
+        oos.writeObject(dp);
+        oos.close();
+
+        ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+        ObjectInputStream ois = new ObjectInputStream(bais) {
+            /**
 
 Review comment:
   This comment perhaps belongs on the method signature above.
   
   Can you please explain more why we're having to do more here than just inherit from Serializable?
   
   Is there a maintenance burden here, like all our serializable base classes have to manually call this reserialize thing? 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services