• Post Reply Bookmark Topic Watch Topic
  • New Topic

serizalize primitive data type

 
aakash bhatt
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Q) How can I serizalize primitive data type
Regards,
aakash
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24213
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Within a writeObject() method, you can use the methods of ObjectOutputStream like writeInt(), writeLong(), etc.
But if you're only writing primitives, then don't use serialization -- use DataOutputStream/DataInputStream instead to efficiently tranfer primitives.
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving this to the I/O and Streams forum...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!