Serialize and deserialize object to and from text

Discussion in 'Java' started by Edmond wong, Apr 28, 2005.

  1. Edmond wong

    Edmond wong Guest

    Hi,

    I am looking for a text encoder and text decoder for object
    serialization and deserialization. Any one have work on such a tool
    before and can share the source code?

    I have the encoder working using recursion and reflection, but I don't
    have a clue on the way to use recursion and reflection to read the text
    back to object. In fact, I have been trying to build the decoder and
    have been stucked on the case where the object contain a collection of
    objects.

    The encoder I build have the following text output:

    {book:Book={{name:java.lang.String="Hitchhiker
    Guide"}{author:Author={{name:java.lang.String="Edmond
    Wong"}{email:java.lang.String=""}{address:java.lang.String="123
    Olive
    Ave"}}}{price:double=49.99}{chapters:java.util.Vector={{chapter:Chapter={{no:int=1}{name:java.lang.String="Act
    I"}}}{chapter:Chapter={{no:int=2}{name:java.lang.String="Act
    II"}}}{chapter:Chapter={{no:int=3}{name:java.lang.String="Act III"}}}}}}}


    Thanks,

    Edmond
    Edmond wong, Apr 28, 2005
    #1
    1. Advertising

  2. Edmond wong

    Wendy S Guest

    "Edmond wong" <> wrote

    > I am looking for a text encoder and text decoder for object serialization
    > and deserialization. Any one have work on such a tool before and can
    > share the source code?


    Serialization means binary data, doesn't it? I suppose you could base-64
    encode the bytes, that would be text...

    Is this homework?? I guess I'm just questioning inventing yet another
    proprietary text format that you have to maintain code for.

    But to answer the question, if I had to dump an object to text knowing that
    I would need to reconstitute it later, I would use XML and the following
    libraries from Jakarta:
    http://jakarta.apache.org/commons/betwixt/ Object to XML
    http://jakarta.apache.org/commons/digester/ XML to Object

    --
    Wendy S
    Wendy S, Apr 28, 2005
    #2
    1. Advertising

  3. Edmond wong

    Edmond wong Guest

    Wendy S wrote:
    > "Edmond wong" <> wrote
    >
    >
    >>I am looking for a text encoder and text decoder for object serialization
    >>and deserialization. Any one have work on such a tool before and can
    >>share the source code?

    >
    >
    > Serialization means binary data, doesn't it? I suppose you could base-64
    > encode the bytes, that would be text...
    >
    > Is this homework?? I guess I'm just questioning inventing yet another
    > proprietary text format that you have to maintain code for.
    >
    > But to answer the question, if I had to dump an object to text knowing that
    > I would need to reconstitute it later, I would use XML and the following
    > libraries from Jakarta:
    > http://jakarta.apache.org/commons/betwixt/ Object to XML
    > http://jakarta.apache.org/commons/digester/ XML to Object
    >


    I am more looking for an text encoder and decoder. I have the encoder
    working using reflection and recursion.

    I probably failed to convince my colleage who is a C++ programmer and
    the project lead that xml is the best choice to log message, and to
    regenerate the java object from log for simulation purpose. Anyway, I
    will try again to convince the lead until I figure out the trick to
    finish the decoder.

    Thanks,

    Edmond
    Edmond wong, Apr 29, 2005
    #3
    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. Gordz
    Replies:
    3
    Views:
    3,923
    John Oakes
    Jun 7, 2004
  2. Replies:
    1
    Views:
    832
    David Linsin
    Apr 22, 2006
  3. moonhk
    Replies:
    4
    Views:
    706
  4. MariuszK
    Replies:
    0
    Views:
    775
    MariuszK
    Mar 19, 2007
  5. hardemr
    Replies:
    3
    Views:
    303
Loading...

Share This Page