All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class Acme.SerialUtils

java.lang.Object
   |
   +----Acme.SerialUtils

public class SerialUtils
extends Object
Utilities for serializable objects.

These static routines help you serialize and deserialize the primitive data types. Your own serialization routines will just be sequences of calls to these.

This implementation of serialization is much simpler and less convenient to use than the official one that will be in JDK1.1; but it has the significant albeit temporary advantage that it works in current browsers.

One thing this version does not do is handle cyclic graphs of objects. It only handles tree-shaped graphs. If you need to serialize more complicated structures, consider using an ID-based scheme - instead of having your objects contain actual references to other objects, have them contain IDs which can be translated into real references by an ID-manager class. This scheme also has the advantage that you don't have to deserialize the entire graph all at once, you can do it piece by piece as needed, and you can even set up a least-recently-used flush policy in the ID-manager.

Fetch the software.
Fetch the entire Acme package.

See Also:
Serializable

Constructor Index

 o SerialUtils()

Method Index

 o deserializeArrayByte(DataInputStream)
Utility routine to deserialize an array of bytes.
 o deserializeArrayChar(DataInputStream)
Utility routine to deserialize an array of chars.
 o deserializeArrayDouble(DataInputStream)
Utility routine to deserialize an array of doubles.
 o deserializeArrayFloat(DataInputStream)
Utility routine to deserialize an array of floats.
 o deserializeArrayInt(DataInputStream)
Utility routine to deserialize an array of ints.
 o deserializeArrayLong(DataInputStream)
Utility routine to deserialize an array of longs.
 o deserializeArrayObject(DataInputStream)
Utility routine to deserialize an array of objects.
 o deserializeArrayShort(DataInputStream)
Utility routine to deserialize an array of shorts.
 o deserializeBoolean(DataInputStream)
Utility routine to deserialize a boolean.
 o deserializeByte(DataInputStream)
Utility routine to deserialize a byte.
 o deserializeChar(DataInputStream)
Utility routine to deserialize a char.
 o deserializeDouble(DataInputStream)
Utility routine to deserialize a double.
 o deserializeFloat(DataInputStream)
Utility routine to deserialize a float.
 o deserializeHeader(Class, DataInputStream)
Utility routine to read a serialization header.
 o deserializeInt(DataInputStream)
Utility routine to deserialize a int.
 o deserializeLong(DataInputStream)
Utility routine to deserialize a long.
 o deserializeObject(Class, DataInputStream)
Utility routine to deserialize a sub-object.
 o deserializeShort(DataInputStream)
Utility routine to deserialize a short.
 o deserializeString(DataInputStream)
Utility routine to deserialize a String.
 o deserializeTrailer(Class, DataInputStream)
Utility routine to read a serialization trailer.
 o main(String[])
Test routine.
 o serializeArrayByte(byte[], DataOutputStream)
Utility routine to serialize an array of bytes.
 o serializeArrayChar(char[], DataOutputStream)
Utility routine to serialize an array of chars.
 o serializeArrayDouble(double[], DataOutputStream)
Utility routine to serialize an array of doubles.
 o serializeArrayFloat(float[], DataOutputStream)
Utility routine to serialize an array of floats.
 o serializeArrayInt(int[], DataOutputStream)
Utility routine to serialize an array of ints.
 o serializeArrayLong(long[], DataOutputStream)
Utility routine to serialize an array of longs.
 o serializeArrayObject(Serializable[], DataOutputStream)
Utility routine to serialize an array of Objects.
 o serializeArrayShort(short[], DataOutputStream)
Utility routine to serialize an array of shorts.
 o serializeBoolean(boolean, DataOutputStream)
Utility routine to serialize a boolean.
 o serializeByte(byte, DataOutputStream)
Utility routine to serialize a byte.
 o serializeChar(char, DataOutputStream)
Utility routine to serialize a char.
 o serializeDouble(double, DataOutputStream)
Utility routine to serialize a double.
 o serializeFloat(float, DataOutputStream)
Utility routine to serialize a float.
 o serializeInt(int, DataOutputStream)
Utility routine to serialize a int.
 o serializeLong(long, DataOutputStream)
Utility routine to serialize a long.
 o serializeObject(Serializable, DataOutputStream)
Utility routine to serialize a sub-object.
 o serializeShort(short, DataOutputStream)
Utility routine to serialize a short.
 o serializeString(String, DataOutputStream)
Utility routine to serialize a String.

Constructors

 o SerialUtils
 public SerialUtils()

Methods

 o serializeObject
 public static void serializeObject(Serializable ser,
                                    DataOutputStream dout) throws IOException
Utility routine to serialize a sub-object.

 o serializeString
 public static void serializeString(String str,
                                    DataOutputStream dout) throws IOException
Utility routine to serialize a String.

 o serializeBoolean
 public static void serializeBoolean(boolean b,
                                     DataOutputStream dout) throws IOException
Utility routine to serialize a boolean.

 o serializeByte
 public static void serializeByte(byte b,
                                  DataOutputStream dout) throws IOException
Utility routine to serialize a byte.

 o serializeChar
 public static void serializeChar(char c,
                                  DataOutputStream dout) throws IOException
Utility routine to serialize a char.

 o serializeShort
 public static void serializeShort(short s,
                                   DataOutputStream dout) throws IOException
Utility routine to serialize a short.

 o serializeInt
 public static void serializeInt(int i,
                                 DataOutputStream dout) throws IOException
Utility routine to serialize a int.

 o serializeLong
 public static void serializeLong(long l,
                                  DataOutputStream dout) throws IOException
Utility routine to serialize a long.

 o serializeFloat
 public static void serializeFloat(float f,
                                   DataOutputStream dout) throws IOException
Utility routine to serialize a float.

 o serializeDouble
 public static void serializeDouble(double d,
                                    DataOutputStream dout) throws IOException
Utility routine to serialize a double.

 o serializeArrayObject
 public static void serializeArrayObject(Serializable ao[],
                                         DataOutputStream dout) throws IOException
Utility routine to serialize an array of Objects.

 o serializeArrayByte
 public static void serializeArrayByte(byte ab[],
                                       DataOutputStream dout) throws IOException
Utility routine to serialize an array of bytes.

 o serializeArrayChar
 public static void serializeArrayChar(char ac[],
                                       DataOutputStream dout) throws IOException
Utility routine to serialize an array of chars.

 o serializeArrayShort
 public static void serializeArrayShort(short as[],
                                        DataOutputStream dout) throws IOException
Utility routine to serialize an array of shorts.

 o serializeArrayInt
 public static void serializeArrayInt(int ai[],
                                      DataOutputStream dout) throws IOException
Utility routine to serialize an array of ints.

 o serializeArrayLong
 public static void serializeArrayLong(long al[],
                                       DataOutputStream dout) throws IOException
Utility routine to serialize an array of longs.

 o serializeArrayFloat
 public static void serializeArrayFloat(float af[],
                                        DataOutputStream dout) throws IOException
Utility routine to serialize an array of floats.

 o serializeArrayDouble
 public static void serializeArrayDouble(double ad[],
                                         DataOutputStream dout) throws IOException
Utility routine to serialize an array of doubles.

 o deserializeHeader
 public static boolean deserializeHeader(Class cl,
                                         DataInputStream din) throws IOException
Utility routine to read a serialization header. Special case: returns false if the object is null.

 o deserializeTrailer
 public static void deserializeTrailer(Class cl,
                                       DataInputStream din) throws IOException
Utility routine to read a serialization trailer.

 o deserializeObject
 public static Serializable deserializeObject(Class cl,
                                              DataInputStream din) throws IOException
Utility routine to deserialize a sub-object.

 o deserializeString
 public static String deserializeString(DataInputStream din) throws IOException
Utility routine to deserialize a String.

 o deserializeBoolean
 public static boolean deserializeBoolean(DataInputStream din) throws IOException
Utility routine to deserialize a boolean.

 o deserializeByte
 public static byte deserializeByte(DataInputStream din) throws IOException
Utility routine to deserialize a byte.

 o deserializeChar
 public static char deserializeChar(DataInputStream din) throws IOException
Utility routine to deserialize a char.

 o deserializeShort
 public static short deserializeShort(DataInputStream din) throws IOException
Utility routine to deserialize a short.

 o deserializeInt
 public static int deserializeInt(DataInputStream din) throws IOException
Utility routine to deserialize a int.

 o deserializeLong
 public static long deserializeLong(DataInputStream din) throws IOException
Utility routine to deserialize a long.

 o deserializeFloat
 public static float deserializeFloat(DataInputStream din) throws IOException
Utility routine to deserialize a float.

 o deserializeDouble
 public static double deserializeDouble(DataInputStream din) throws IOException
Utility routine to deserialize a double.

 o deserializeArrayObject
 public static Serializable[] deserializeArrayObject(DataInputStream din) throws IOException
Utility routine to deserialize an array of objects.

 o deserializeArrayByte
 public static byte[] deserializeArrayByte(DataInputStream din) throws IOException
Utility routine to deserialize an array of bytes.

 o deserializeArrayChar
 public static char[] deserializeArrayChar(DataInputStream din) throws IOException
Utility routine to deserialize an array of chars.

 o deserializeArrayShort
 public static short[] deserializeArrayShort(DataInputStream din) throws IOException
Utility routine to deserialize an array of shorts.

 o deserializeArrayInt
 public static int[] deserializeArrayInt(DataInputStream din) throws IOException
Utility routine to deserialize an array of ints.

 o deserializeArrayLong
 public static long[] deserializeArrayLong(DataInputStream din) throws IOException
Utility routine to deserialize an array of longs.

 o deserializeArrayFloat
 public static float[] deserializeArrayFloat(DataInputStream din) throws IOException
Utility routine to deserialize an array of floats.

 o deserializeArrayDouble
 public static double[] deserializeArrayDouble(DataInputStream din) throws IOException
Utility routine to deserialize an array of doubles.

 o main
 public static void main(String args[])
Test routine.


All Packages  Class Hierarchy  This Package  Previous  Next  Index

ACME Java  ACME Labs