How to serialize a non-serializable in Java?

前端 未结 5 1755
太阳男子
太阳男子 2020-11-27 19:54

How can I serialize an object that does not implement Serializable? I cannot mark it Serializable because the class is from a 3rd party library.

5条回答
  •  借酒劲吻你
    2020-11-27 20:28

    If the class is not final, you can make your own class that extends it and implements Serializable. There are lots of other ways to serialize besides Java's built-in mechanism though.

提交回复
热议问题