serialize spoilers

Discussion in 'Java' started by bob smith, Oct 24, 2012.

  1. bob smith

    bob smith Guest

    What do you typically do when you want to serialize an object that doesn't naturally implement Serializable?
     
    bob smith, Oct 24, 2012
    #1
    1. Advertising

  2. bob smith

    Roedy Green Guest

    On Wed, 24 Oct 2012 14:05:00 -0700 (PDT), bob smith
    <> wrote, quoted or indirectly quoted someone
    who said :

    >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.
     
    Roedy Green, Oct 25, 2012
    #2
    1. Advertising

  3. bob smith

    Arne Vajhøj Guest

    On 10/24/2012 5:05 PM, bob smith wrote:
    > 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
     
    Arne Vajhøj, Oct 25, 2012
    #3
  4. bob smith

    Lew Guest

    bob smith wrote:
    > 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.

    --
    Lew
     
    Lew, Oct 25, 2012
    #4
  5. bob smith

    Sebastian Guest

    Sebastian, Oct 27, 2012
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sergio Dinis

    How to Serialize System.Drawing.Pen

    Sergio Dinis, Oct 2, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    2,517
    Jay B. Harlow [MVP - Outlook]
    Oct 3, 2003
  2. Mike Larkin
    Replies:
    1
    Views:
    6,124
    Alvin Bruney [MVP - ASP.NET]
    May 23, 2005
  3. Gordz
    Replies:
    3
    Views:
    3,985
    John Oakes
    Jun 7, 2004
  4. Bruno Desthuilliers
    Replies:
    30
    Views:
    1,108
    paulhankin
    Sep 19, 2007
  5. Steven D'Aprano

    [SPOILERS] Python easter eggs

    Steven D'Aprano, Jul 3, 2013, in forum: Python
    Replies:
    5
    Views:
    117
    alex23
    Jul 4, 2013
Loading...

Share This Page