aspose file tools*
The moose likes Java Micro Edition and the fly likes Can we store Objects other than String in  RMS Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "Can we store Objects other than String in  RMS" Watch "Can we store Objects other than String in  RMS" New topic
Author

Can we store Objects other than String in RMS

Harish Tiruvile
Ranch Hand

Joined: Dec 01, 2005
Posts: 99
Hi,


While reading J2me Record Management System i found examples only on primitive data types and String Objects ..

For writing int we used writeInt(bytearray[]) method,
For String Objects we used WriteUTF(bytearray[]) method

My question is::
I have developed one class called Animal , i want to know whether i can write Animal Object in to RMS using WriteUTF(bytearray[]) method...
I mean can we use WriteUTF(bytearray[]) method to write any Objects in to RMS...

if it is not possible then how can i write Objects other than String into RMS.......I am not getting answer in books and website since all are concentrating on primitive types and String ...
[ April 18, 2006: Message edited by: harish thrivile ]

Giving up is the easiest thing in the world to do..but holding it together when everything seems like falling apart is true strength!!
with regards, Harish.T
Ramender Mall
Ranch Hand

Joined: Sep 08, 2005
Posts: 311
You seem to refer to something like ObjectOutputStream in J2SE. BUT, i think there is no support for such a thing in J2ME.

The way around is, we can store the values of the members of the class and later retrieve them. Say if a class has 2 string and 1 int member, store these values in RMS and then when needed retrieve these values and assign them back to those members.

Agreed, that structures of classes are much more complex, but there is always a way around.

More Details on Object serialization --> LOOK HERE...

- Ramy..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can we store Objects other than String in RMS