NotSerializableException:-Problem in Serailization
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Rohit_Seth
Posted On:   Friday, September 14, 2001 03:56 AM

I am trying to serialize an object and pass it through InputStream Object.

I am getting NotSerializableException.

My class implements Serializable interface so that is not the problem.


1) I am using some .ppm files (portable pixmap file format) and certain xml files in the class.
Just wanted to know if that can cause any problem during Serialization?


2) Should abstract class also implement Serializable interface. I dont think so??
3) Also should myInterface also extend Serializable? Again I dont think so.
Pl clear my doubts. TIA.

Re: NotSerializableException:-Problem in Serailization

Posted By:   Kevin_Riff  
Posted On:   Sunday, September 16, 2001 10:08 PM

Interfaces and abstract classes do not need to implement Serializable, however if they do then you guarantee that any sub-classes will also be serializable. Otherwise, the person who implements your interface or extends your class may choose not to implement Serializable at the same time. Also, any data in the abstract class will not be serialized unless that class implements Serializable.



You mention .ppm files which I think are a type of image, correct? You should be aware then that the Image class is not serializable. If you must save an image to a stream, then you will need to handle it specially. Check out this FAQ entry for more details.

About | Sitemap | Contact