• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Store objects in Record Store?

 
Pat Nicholls
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is this possible? If so how? Or failing that how can I store more than one field into 1 record?
Thanks
Pat
 
Richard Taylor
Author
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't store objects as such, but you can store primitive Java types (int, long, char, etc), by using java.io.DataInputStream and java.io.DataOutputStream.
If you want to sotre more than 1 field in a record, then you will have to write your own encode and decode routines. A shame, but that's the way it goes. If you look at my book, you'll see a Record class, which is comprised of n Fields. It might be what you want (although, for the simplicity of the chapter I do assume all Fields are Strings...)
------------------
Richard Taylor
Author of Professional Java Mobile Programming
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic