You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Edmond Wong <wy...@pacbell.net> on 2005/04/28 06:17:59 UTC

Serialize and deserialize object to and from text

Hi,

I am looking for a text encoder and text decoder for object 
serialization and deserialization.  Anyone has worked 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 Java beans.  In fact, I have been trying to build the decoder 
for weeks, and have been stucked on the case where the object contain a 
collection of objects.

The encoder I have built 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="edmond.wong@pacbell.net"}{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

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: Serialize and deserialize object to and from text

Posted by Mattias J <mj...@expertsystem.se>.
At 2005-04-28 09:15, you wrote:
>(Base64 encoder/decoder exists in one of jakarta projects, I do not 
>remember which one).

(My guess is Commons Codec) 


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: Serialize and deserialize object to and from text

Posted by Catalin Grigoroscuta <c....@moodmedia.ro>.
Hi,

Have you considered using the java.beans.XMLEncoder/XMLDecoder classes 
(JDK 1.4)?
Or, if you are just interested in "text encoder/decoder", without being 
human readable, you could just serialize and the encode Base64 (Base64 
encoder/decoder exists in one of jakarta projects, I do not remember 
which one).

Catalin

>>Hi,
>>
>>I am looking for a text encoder and text decoder for object 
>>serialization and deserialization.  Anyone has worked 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 Java beans.  In fact, I have been trying to build the decoder 
>>for weeks, and have been stucked on the case where the object contain a 
>>collection of objects.
>>
>>The encoder I have built 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="edmond.wong@pacbell.net"}{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
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>    
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: Serialize and deserialize object to and from text

Posted by Frédéric Desmoulins <to...@no-log.org>.
Hi,

If you consider that XML is text (it should be the case), then you can
check out Betwixt.

fred

Le mercredi 27 avril 2005 à 21:17 -0700, Edmond Wong a écrit :
> Hi,
> 
> I am looking for a text encoder and text decoder for object 
> serialization and deserialization.  Anyone has worked 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 Java beans.  In fact, I have been trying to build the decoder 
> for weeks, and have been stucked on the case where the object contain a 
> collection of objects.
> 
> The encoder I have built 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="edmond.wong@pacbell.net"}{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
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: Serialize and deserialize object to and from text

Posted by Edmond Wong <wy...@pacbell.net>.
Many thanks PA. I just tried the tool to test object->text, and 
text->object, it is exactly what I need. 

PA wrote:

>
> On Apr 28, 2005, at 06:17, Edmond Wong wrote:
>
>> I am looking for a text encoder and text decoder for object 
>> serialization and deserialization.  Anyone has worked on such a tool 
>> before, and can share the source code?
>
>
> Take a look at PL:
>
> http://alt.textdrive.com/pl/
>
> Usage example:
>
> // serializing an object to PL
>
> new PLObjectOutput( anOutputStream ).writeObject( anObject );
>
> // deserializing an object back from PL
>
> new PLObjectInput( anInputStream ).readObject();
>
> http://alt.textdrive.com/pl/5/pl-the-implementation
>
> Source code:
>
> http://dev.alt.textdrive.com/browser/pl/
>
> Cheers
>
> -- 
> PA, Onnay Equitursay
> http://alt.textdrive.com/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: Serialize and deserialize object to and from text

Posted by Edmond Wong <wy...@pacbell.net>.
Thanks, I will try it out.

PA wrote:

>
> On Apr 28, 2005, at 06:17, Edmond Wong wrote:
>
>> I am looking for a text encoder and text decoder for object 
>> serialization and deserialization.  Anyone has worked on such a tool 
>> before, and can share the source code?
>
>
> Take a look at PL:
>
> http://alt.textdrive.com/pl/
>
> Usage example:
>
> // serializing an object to PL
>
> new PLObjectOutput( anOutputStream ).writeObject( anObject );
>
> // deserializing an object back from PL
>
> new PLObjectInput( anInputStream ).readObject();
>
> http://alt.textdrive.com/pl/5/pl-the-implementation
>
> Source code:
>
> http://dev.alt.textdrive.com/browser/pl/
>
> Cheers
>
> -- 
> PA, Onnay Equitursay
> http://alt.textdrive.com/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: Serialize and deserialize object to and from text

Posted by PA <pe...@gmail.com>.
On Apr 28, 2005, at 06:17, Edmond Wong wrote:

> I am looking for a text encoder and text decoder for object 
> serialization and deserialization.  Anyone has worked on such a tool 
> before, and can share the source code?

Take a look at PL:

http://alt.textdrive.com/pl/

Usage example:

// serializing an object to PL

new PLObjectOutput( anOutputStream ).writeObject( anObject );

// deserializing an object back from PL

new PLObjectInput( anInputStream ).readObject();

http://alt.textdrive.com/pl/5/pl-the-implementation

Source code:

http://dev.alt.textdrive.com/browser/pl/

Cheers

--
PA, Onnay Equitursay
http://alt.textdrive.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org