Serializable is avaliable in J2SE and J2EE only.
However, you can do it manually. To do that you just need to write each value individually into a radiogram or a byte stream...
radiogram.reset();
radiogram.writeInt(1000); // integer
radiogram.writeUTF("hello"); // string
then when you get the radiogram or stream on the host decode it in the exact same order
int number = radiogram.readInt(); // integer
String text = radiogram.readUTF(); // string
so if you have an object that you wnat to serialise you could just add a method to encode to radiogram, and likewsie decode...
没有评论:
发表评论