CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation

com.tangosol.io.pof
Class PortableObjectSerializer

java.lang.Object
  extended by com.tangosol.util.Base
      extended by com.tangosol.io.pof.PofHelper
          extended by com.tangosol.io.pof.PortableObjectSerializer
All Implemented Interfaces:
PofConstants, PofSerializer

public class PortableObjectSerializer
extends PofHelper
implements PofSerializer

PofSerializer implementation that supports the serialization and deserialization of any class that implements PortableObject to and from a POF stream.

Since:
Coherence 3.2
Author:
jh 2006.07.18

Nested Class Summary
 
Nested classes/interfaces inherited from class com.tangosol.io.pof.PofHelper
PofHelper.ReadableEntrySetMap, PofHelper.WriteableEntrySetMap
 
Field Summary
protected  int m_nTypeId
          The type identifier of the user type to serialize and deserialize.
 
Fields inherited from class com.tangosol.io.pof.PofHelper
BIGDECIMAL_ZERO, BINARY_EMPTY, BOOLEAN_ARRAY_EMPTY, BYTE_ARRAY_EMPTY, CHAR_ARRAY_EMPTY, COLLECTION_EMPTY, DOUBLE_ARRAY_EMPTY, FLOAT_ARRAY_EMPTY, INT_ARRAY_EMPTY, LONG_ARRAY_EMPTY, OBJECT_ARRAY_EMPTY, SHORT_ARRAY_EMPTY
 
Fields inherited from interface com.tangosol.io.pof.PofConstants
J_BIG_DECIMAL, J_BIG_INTEGER, J_BINARY, J_BOOLEAN, J_BOOLEAN_ARRAY, J_BYTE, J_BYTE_ARRAY, J_CHAR_ARRAY, J_CHARACTER, J_COLLECTION, J_DATE, J_DATETIME, J_DOUBLE, J_DOUBLE_ARRAY, J_FLOAT, J_FLOAT_ARRAY, J_INT_ARRAY, J_INTEGER, J_LONG, J_LONG_ARRAY, J_MAP, J_NULL, J_OBJECT_ARRAY, J_QUAD, J_RAW_DATE, J_RAW_DATETIME, J_RAW_DAY_TIME_INTERVAL, J_RAW_TIME, J_RAW_TIME_INTERVAL, J_RAW_YEAR_MONTH_INTERVAL, J_SHORT, J_SHORT_ARRAY, J_SPARSE_ARRAY, J_STRING, J_TIME, J_TIMESTAMP, J_USER_TYPE, MAX_DECIMAL128_SCALE, MAX_DECIMAL128_UNSCALED, MAX_DECIMAL32_SCALE, MAX_DECIMAL32_UNSCALED, MAX_DECIMAL64_SCALE, MAX_DECIMAL64_UNSCALED, MIN_DECIMAL128_SCALE, MIN_DECIMAL32_SCALE, MIN_DECIMAL64_SCALE, T_ARRAY, T_BOOLEAN, T_CHAR, T_CHAR_STRING, T_COLLECTION, T_DATE, T_DATETIME, T_DAY_TIME_INTERVAL, T_DECIMAL128, T_DECIMAL32, T_DECIMAL64, T_FLOAT128, T_FLOAT32, T_FLOAT64, T_IDENTITY, T_INT128, T_INT16, T_INT32, T_INT64, T_MAP, T_OCTET, T_OCTET_STRING, T_REFERENCE, T_SPARSE_ARRAY, T_TIME, T_TIME_INTERVAL, T_UNIFORM_ARRAY, T_UNIFORM_COLLECTION, T_UNIFORM_KEYS_MAP, T_UNIFORM_MAP, T_UNIFORM_SPARSE_ARRAY, T_YEAR_MONTH_INTERVAL, V_BOOLEAN_FALSE, V_BOOLEAN_TRUE, V_COLLECTION_EMPTY, V_FP_NAN, V_FP_NEG_INFINITY, V_FP_POS_INFINITY, V_INT_0, V_INT_1, V_INT_10, V_INT_11, V_INT_12, V_INT_13, V_INT_14, V_INT_15, V_INT_16, V_INT_17, V_INT_18, V_INT_19, V_INT_2, V_INT_20, V_INT_21, V_INT_22, V_INT_3, V_INT_4, V_INT_5, V_INT_6, V_INT_7, V_INT_8, V_INT_9, V_INT_NEG_1, V_REFERENCE_NULL, V_STRING_ZERO_LENGTH
 
Constructor Summary
PortableObjectSerializer(int nTypeId)
          Create a new PortableObjectSerializer for the user type with the given type identifier.
 
Method Summary
 Object deserialize(PofReader in)
          Deserialize a user type instance from a POF stream by reading its state using the specified PofReader object.
 void serialize(PofWriter out, Object o)
          Serialize a user type instance to a POF stream by writing its state using the specified PofWriter object.
 
Methods inherited from class com.tangosol.io.pof.PofHelper
calcDecimalSize, checkDate, checkDayTimeInterval, checkDecimalRange, checkElementCount, checkReferenceRange, checkTime, checkTimeInterval, checkTimeZone, checkType, checkYearMonthInterval, convertNumber, convertToDate, decodeTinyInt, encodeTinyInt, formatDate, formatTime, formatTime, getJavaTypeId, getPofTypeId, readAsBigDecimal, readAsBigInteger, readAsChar, readAsDouble, readAsFloat, readAsInt, readAsLong, readAsQuad, readBigDecimal, readBigInteger, readChar, readQuad, readRawDate, readRawTime, resizeArray, skipPackedInts, skipUniformValue, skipValue, writeBigDecimal, writeBigInteger, writeDate, writeTime
 

Field Detail

m_nTypeId

protected final int m_nTypeId
The type identifier of the user type to serialize and deserialize.

Constructor Detail

PortableObjectSerializer

public PortableObjectSerializer(int nTypeId)
Create a new PortableObjectSerializer for the user type with the given type identifier.

Parameters:
nTypeId - the user type identifier
Method Detail

serialize

public void serialize(PofWriter out,
                      Object o)
               throws IOException
Serialize a user type instance to a POF stream by writing its state using the specified PofWriter object.

An implementation of PofSerializer is required to follow the following steps in sequence for writing out an object of a user type:

  1. If the object is evolvable, the implementation must set the version by calling PofWriter.setVersionId(int).
  2. The implementation may write any combination of the properties of the user type by using the "write" methods of the PofWriter, but it must do so in the order of the property indexes.
  3. After all desired properties of the user type have been written, the implementation must terminate the writing of the user type by calling PofWriter.writeRemainder(com.tangosol.util.Binary).

Specified by:
serialize in interface PofSerializer
Parameters:
out - the PofWriter with which to write the object's state
o - the object to serialize
Throws:
IOException - if an I/O error occurs

deserialize

public Object deserialize(PofReader in)
                   throws IOException
Deserialize a user type instance from a POF stream by reading its state using the specified PofReader object.

An implementation of PofSerializer is required to follow the following steps in sequence for reading in an object of a user type:

  1. If the object is evolvable, the implementation must get the version by calling PofWriter.getVersionId().
  2. The implementation may read any combination of the properties of the user type by using "read" methods of the PofReader, but it must do so in the order of the property indexes.
  3. After all desired properties of the user type have been read, the implementation must terminate the reading of the user type by calling PofReader.readRemainder().

Specified by:
deserialize in interface PofSerializer
Parameters:
in - the PofReader with which to read the object's state
Returns:
the deserialized user type instance
Throws:
IOException - if an I/O error occurs

CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation