Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Serialize primitive types

So is there a way to achieve serializing the primitive data?

EDIT Any Specific Example will be great.

like image 872
BOSS Avatar asked Jul 07 '11 13:07

BOSS


2 Answers

Primitive types can be serialized using DataOutputStream class and deserialized using DataInputStream class

like image 160
BOSS Avatar answered Oct 16 '22 17:10

BOSS


All of the primitive types have write methods in the class ObjectOutputStream. You can serialize any primitive via an ObjectOutputStream in this manner. For details see the Java API page for ObjectOutputStream.

like image 33
ncmathsadist Avatar answered Oct 16 '22 15:10

ncmathsadist