|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.cometway.util.ObjectSerializer
public class ObjectSerializer
This class has static methods that serialize and unserialize Objects to and from byte[] arrays. This array will also contain the ObjectHeader with the magic numbers. I highly suggest not modifying the byte[] array unless you know what you are doing.
Serializable| Constructor Summary | |
|---|---|
ObjectSerializer()
|
|
| Method Summary | |
|---|---|
static byte[] |
serialize(java.lang.Object o)
This method serializes an Object into a byte[] array. |
static java.lang.Object |
unserialize(byte[] data)
This method unserializes a byte[] array into a single Object. |
static java.lang.Object |
unserialize(byte[] data,
int offset,
int length)
This method unserializes a byte[] array into a single Object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ObjectSerializer()
| Method Detail |
|---|
public static java.lang.Object unserialize(byte[] data)
throws java.io.IOException,
java.io.OptionalDataException,
java.lang.ClassNotFoundException
data - This is the serialied data to unserialize. The entire length of the array is used.
java.io.IOException - Thrown when an I/O Exception occurs while creating the ObjectStream or reading the Object
java.io.OptionalDataException - Thrown when unexpected data is in the byte[] array.
java.lang.ClassNotFoundException - Thrown when the unserialzed object's Class is not found.
public static java.lang.Object unserialize(byte[] data,
int offset,
int length)
throws java.io.IOException,
java.io.OptionalDataException,
java.lang.ClassNotFoundException
data - This is the serialied data to unserialize.length - Up to this many bytes in the array are to be unserialized.
java.io.IOException - Thrown when an I/O Exception occurs while creating the ObjectStream or reading the Object
java.io.OptionalDataException - Thrown when unexpected data is in the byte[] array.
java.lang.ClassNotFoundException - Thrown when the unserialzed object's Class is not found.
public static byte[] serialize(java.lang.Object o)
throws java.io.IOException,
java.io.NotSerializableException
o - This is the object to serialize.
java.io.IOException - Thrown when an I/O Exception occurs while creating the ObjectStream or writing the Object
java.io.NotSerializableException - Thrown if the Object cannot be serializable.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||