Can I serialize an object that has native methods?

Tim Rohaly

Method implementations, whether native or pure Java, are not part of the serialized state of an object. There is nothing that prevents objects with native methods from being serialized.

It might however be problematic in practice to reconstitute these objects if the native code can't be loaded, e.g. when sending serialized objects over a socket where the other end doesn't have the native library installed. It is of course also a problem if the other end can't load the .class files, but native libraries can't be dynamically downloaded like .class files.

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact