serialize spoilers

B

bob smith

What do you typically do when you want to serialize an object that doesn't naturally implement Serializable?
 
R

Roedy Green

What do you typically do when you want to serialize an object that doesn't naturally implement Serializable?
If it is a built-in class, there is probably a good reason it is not
Serializable. For example Images contain platform specific
information, so you cannot save Images on one platform and
reconstitute them on another.

You can mark references transient, and restore them on your own
somehow.

You can look for some third party solution, or save them in some other
format, e.g. images as PNG files.

--
Roedy Green Canadian Mind Products http://mindprod.com
There are four possible ways to poke a card into a slot.
Nearly always, only one way works. To me that betrays a
Fascist mentality, demanding customers conform to some
arbitrary rule, and hassling them to discover the magic
orientation. The polite way to do it is to design the reader
slot so that all four ways work, or so that all the customer
has to do is put the card in the vicinity of the reader.
 
A

Arne Vajhøj

What do you typically do when you want to serialize an object that doesn't naturally implement Serializable?

I think you could use Ted Neward's Serializable Adapter approach.

Unfortunately I can not find a working link to that anymore.

Arne
 
L

Lew

bob said:
What do you typically do when you want to serialize an object that doesn't naturally implement Serializable?

Nothing without first reading the section of /Effective Java/ by Joshua Bloch that tells you how
to deal with serialization.
http://my.safaribooksonline.com/book/programming/java/9780137150021
http://books.google.com/books?id=Ft8t0S4VjmwC&pg=PA289&source=gbs_toc_r&cad=4

You need to buy the book to get every page, but that's all right because you need to buy the book.

Suffice to say that there are mechanisms to deal with your situation, but you aren't going to learn
the fundamentals of serialization by asking random questions on Usenet.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top