|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.funambol.storage.ComplexSerializer
public class ComplexSerializer
A helper class useful to persist objects like Vector
s and
Hashtable
s into the device's store
Constructor Summary | |
---|---|
ComplexSerializer()
|
Method Summary | |
---|---|
static java.util.Hashtable |
deserializeHashTable(java.io.DataInputStream din)
A helper method to deserialize a Hashtable |
static java.lang.Object |
deserializeObject(java.io.DataInputStream din)
A helper method to deserialize an Object . |
static java.lang.Object[] |
deserializeObjectArray(java.io.DataInputStream in)
Deserialize a given DataInputStream into a given array of objects. |
static java.util.Vector |
deserializeVector(java.io.DataInputStream din)
A helper method to deserialize a Vector |
static java.util.Date |
readDateField(java.io.DataInputStream in)
Read a UTF field to the given DataInputStream. |
static java.lang.String |
readField(java.io.DataInputStream in)
Read a UTF field to the given DataInputStream If the field exists write a "true", "False" otherwise |
static void |
serializeHashTable(java.io.DataOutputStream dout,
java.util.Hashtable ht)
A helper method to serialize a Hashtable |
static void |
serializeObject(java.io.DataOutputStream dout,
java.lang.Object obj)
A helper method to serialize an Object . |
static void |
serializeObjectArray(java.io.DataOutputStream out,
java.lang.Object[] obj)
Serialize a given array of objects into a given DataOutputStream |
static void |
serializeVector(java.io.DataOutputStream dout,
java.util.Vector v)
A helper method to serialize a Vector |
static void |
writeDateField(java.io.DataOutputStream out,
java.util.Date field)
Write a Date field to the given DataOutputStream. |
static void |
writeField(java.io.DataOutputStream out,
java.lang.String field)
Write a UTF field to the given DataOutputStream If the field is not null write a "true" before the field, just "False" otherwise. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ComplexSerializer()
Method Detail |
---|
public static void serializeObject(java.io.DataOutputStream dout, java.lang.Object obj) throws java.io.IOException
Object
.It can serialize basic objects and the ones implementing the Serializable interface. TODO: implement more basic objects.
dout
- The stream to write data toobj
- The Object to be serialized
java.io.IOException
public static java.lang.Object deserializeObject(java.io.DataInputStream din) throws java.io.IOException
Object
.It can deserialize basic objects and the ones implementing the Serializable interface. TODO: implement more basic objects.
din
- The stream to write data from
java.io.IOException
public static void serializeHashTable(java.io.DataOutputStream dout, java.util.Hashtable ht) throws java.io.IOException
Hashtable
dout
- The stream to write data toht
- The Hashtable to be serialized
java.io.IOException
public static java.util.Hashtable deserializeHashTable(java.io.DataInputStream din) throws java.io.IOException
Hashtable
din
- The stream to write data from
java.io.IOException
public static void serializeVector(java.io.DataOutputStream dout, java.util.Vector v) throws java.io.IOException
Vector
dout
- The stream to write data tov
- The Vector to be serialized
java.io.IOException
public static java.util.Vector deserializeVector(java.io.DataInputStream din) throws java.io.IOException
Vector
din
- The stream to write data to
java.io.IOException
public static void writeField(java.io.DataOutputStream out, java.lang.String field) throws java.io.IOException
out
- is the DataOutputStream to be written onfield
- is the field to be written on the
java.io.IOException
- Use this method to write a string that can be null at the moment of the serialization: null field will be written as boolean false into the OutputStream.
Read the written Stream using the com.funambol.common.ComplexSerializer.readField(DataOutputStream in) method.
public static java.lang.String readField(java.io.DataInputStream in) throws java.io.IOException
in
- is the DataInputStream to be read
Use this method to read a string written with: com.funambol.common.ComplexSerializer.writeField(DataInputStream out, String field) method.
java.io.IOException
public static void serializeObjectArray(java.io.DataOutputStream out, java.lang.Object[] obj) throws java.io.IOException
out
- is the stream to be writtens
- is the Serializable object array to be serialized
java.io.IOException
public static java.lang.Object[] deserializeObjectArray(java.io.DataInputStream in) throws java.io.IOException
out
- is the stream to be writtens
- is the Serializable object array to be serialized
java.io.IOException
public static void writeDateField(java.io.DataOutputStream out, java.util.Date field) throws java.io.IOException
Use this method to write a Date field that can be null: null field will be written as 0L into the OutputStream.
Read the written Stream using the com.funambol.common.ComplexSerializer.readDateField(DataOutputStream in) method.
out
- is the DataOutputStream to be written onDate
- is the field to be written on the
java.io.IOException
- Note: the midnight of the 01/01/1970 will be considered null.public static java.util.Date readDateField(java.io.DataInputStream in) throws java.io.IOException
Use this method to read a string written with: com.funambol.common.ComplexSerializer.writeDateField(DataInputStream out, String field) method.
in
- is the DataInputStream to be read
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |