Skip navigation links

Oracle® Coherence Java API Reference
Release 3.7.1.0

E22843-01


com.tangosol.io.pof
Class PofBufferReader.UserTypeReader

java.lang.Object
  extended by com.tangosol.util.Base
      extended by com.tangosol.io.pof.PofHelper
          extended by com.tangosol.io.pof.PofBufferReader
              extended by com.tangosol.io.pof.PofBufferReader.UserTypeReader

All Implemented Interfaces:
PofConstants, PofReader
Enclosing class:
PofBufferReader

public static class PofBufferReader.UserTypeReader
extends PofBufferReader

The UserTypeReader implementation is a contextually-aware PofReader whose purpose is to advance through the properties of a value of a specified user type. The "contextual awareness" refers to the fact that the UserTypeReader maintains state about the type identifier and version of the user type, the parser's property index position within the user type value, and a PofContext that may differ from the PofContext that provided the PofSerializer which is using this UserTypeReader to parse a user type.


Nested Class Summary

 

Nested classes/interfaces inherited from class com.tangosol.io.pof.PofBufferReader
PofBufferReader.IdentityHolder, PofBufferReader.UserTypeReader

 

Nested classes/interfaces inherited from class com.tangosol.io.pof.PofHelper
PofHelper.ReadableEntrySetMap, PofHelper.WriteableEntrySetMap

 

Field Summary

 

Fields inherited from class com.tangosol.io.pof.PofBufferReader
m_arrayRefs, m_ctx, m_in

 

Fields inherited from class com.tangosol.io.pof.PofHelper
BIGDECIMAL_ZERO, BIGINTEGER_MAX_LONG, BIGINTEGER_MIN_LONG, 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_UNKNOWN, 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
PofBufferReader.UserTypeReader(PofBufferReader parent, ReadBuffer.BufferInput in, PofContext ctx, int nTypeId, int nVersionId)
          Construct a parser for parsing the property values of a user type.
PofBufferReader.UserTypeReader(ReadBuffer.BufferInput in, PofContext ctx, int nTypeId, int nVersionId)
          Construct a parser for parsing the property values of a user type.

 

Method Summary
protected  boolean advanceTo(int iProp)
          Advance through the POF stream until the specified property is found.
protected  void closeNested()
          Notify the UserTypeReader that it is being "closed".
protected  void complete(int iProp)
          Register the completion of the parsing of a value.
 PofReader createNestedPofReader(int iProp)
          Obtain a PofReader that can be used to read a set of properties from a single property of the current user type.
protected  PofBufferReader getParentParser()
          If this parser is contextually within a user type, obtain the parser which created this parser in order to parse the user type.
 int getUserTypeId()
          Determine the user type that is currently being parsed.
 int getVersionId()
          Determine the version identifier of the user type that is currently being parsed.
 Binary readRemainder()
          Read all remaining indexed properties of the current user type from the POF stream.
 void registerIdentity(java.lang.Object o)
          Register an identity for a newly created user type instance.

 

Methods inherited from class com.tangosol.io.pof.PofBufferReader
ensureReferenceRegistry, getPofContext, lookupIdentity, readAsObject, readAsObjectArray, readAsUniformObject, readBigDecimal, readBigInteger, readBinary, readBinary, readBoolean, readBooleanArray, readByte, readByteArray, readChar, readCharArray, readCollection, readDate, readDouble, readDoubleArray, readFloat, readFloatArray, readInt, readIntArray, readLong, readLongArray, readLongArray, readMap, readObject, readObjectArray, readRawDate, readRawDateTime, readRawDayTimeInterval, readRawQuad, readRawTime, readRawTimeInterval, readRawYearMonthInterval, readShort, readShortArray, readString, registerIdentity, setPofContext

 

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, isIntrinsicPofType, readAsBigDecimal, readAsBigInteger, readAsChar, readAsDouble, readAsFloat, readAsInt, readAsLong, readAsQuad, readBigDecimal, readBigInteger, readChar, readQuad, readRawDate, readRawTime, resizeArray, skipPackedInts, skipUniformValue, skipValue, writeBigDecimal, writeBigInteger, writeDate, writeTime

 

Constructor Detail

PofBufferReader.UserTypeReader

public PofBufferReader.UserTypeReader(ReadBuffer.BufferInput in,
                                      PofContext ctx,
                                      int nTypeId,
                                      int nVersionId)
                               throws java.io.IOException
Construct a parser for parsing the property values of a user type.
Parameters:
in - the BufferInput that contains the user type data, except for the user type id itself (which is passed passed as a constructor argument)
ctx - the PofContext to use for parsing the user type property values within the user type that this parser will be parsing
nTypeId - the type id of the user type
nVersionId - the version id of the user type
Throws:
java.io.IOException - if an I/O error occurs

PofBufferReader.UserTypeReader

public PofBufferReader.UserTypeReader(PofBufferReader parent,
                                      ReadBuffer.BufferInput in,
                                      PofContext ctx,
                                      int nTypeId,
                                      int nVersionId)
                               throws java.io.IOException
Construct a parser for parsing the property values of a user type.
Parameters:
parent - the parent (ie the containing) PofBufferReader
in - the BufferInput that contains the user type data, except for the user type id itself (which is passed passed as a constructor argument)
ctx - the PofContext to use for parsing the user type property values within the user type that this parser will be parsing
nTypeId - the type id of the user type
nVersionId - the version id of the user type
Throws:
java.io.IOException - if an I/O error occurs

Method Detail

getUserTypeId

public int getUserTypeId()
Determine the user type that is currently being parsed.
Specified by:
getUserTypeId in interface PofReader
Overrides:
getUserTypeId in class PofBufferReader
Returns:
the user type information, or -1 if the PofReader is not currently parsing a user type

getVersionId

public int getVersionId()
Determine the version identifier of the user type that is currently being parsed.
Specified by:
getVersionId in interface PofReader
Overrides:
getVersionId in class PofBufferReader
Returns:
the integer version ID read from the POF stream; always non-negative

registerIdentity

public void registerIdentity(java.lang.Object o)
Register an identity for a newly created user type instance.

If identity/reference types are enabled, an identity is used to uniquely identify a user type instance within a POF stream. The identity immediately proceeds the instance value in the POF stream and can be used later in the stream to reference the instance.

PofSerializer implementations must call this method with the user type instance instantiated during deserialization prior to reading any properties of the instance which are user type instances themselves.

Specified by:
registerIdentity in interface PofReader
Overrides:
registerIdentity in class PofBufferReader
Parameters:
o - the object to register the identity for
See Also:
PofSerializer.deserialize(PofReader)

createNestedPofReader

public PofReader createNestedPofReader(int iProp)
                                throws java.io.IOException
Obtain a PofReader that can be used to read a set of properties from a single property of the current user type. The returned PofReader is only valid from the time that it is returned until the next call is made to this PofReader.
Specified by:
createNestedPofReader in interface PofReader
Overrides:
createNestedPofReader in class PofBufferReader
Parameters:
iProp - the property index to read from
Returns:
a PofReader that reads its contents from a single property of this PofReader
Throws:
java.io.IOException - if an I/O error occurs

readRemainder

public Binary readRemainder()
                     throws java.io.IOException
Read all remaining indexed properties of the current user type from the POF stream. As part of reading in a user type, this method must be called by the PofSerializer that is reading the user type, or the read position within the POF stream will be corrupted.

Subsequent calls to the various readXYZ methods of this interface will fail after this method is called.

Specified by:
readRemainder in interface PofReader
Overrides:
readRemainder in class PofBufferReader
Returns:
a Binary object containing zero or more indexed properties in binary POF encoded form
Throws:
java.io.IOException - if an I/O error occurs

advanceTo

protected boolean advanceTo(int iProp)
                     throws java.io.IOException
Advance through the POF stream until the specified property is found. If the property is found, return true, otherwise return false and advance to the first property that follows the specified property.
Overrides:
advanceTo in class PofBufferReader
Parameters:
iProp - the index of the property to advance to
Returns:
true if the property is found
Throws:
java.io.IOException - if an I/O error occurs

complete

protected void complete(int iProp)
                 throws java.io.IOException
Register the completion of the parsing of a value.
Overrides:
complete in class PofBufferReader
Parameters:
iProp - the property index
Throws:
java.io.IOException - if an I/O error occurs

closeNested

protected void closeNested()
                    throws java.io.IOException
Notify the UserTypeReader that it is being "closed".
Throws:
java.io.IOException - if an I/O error occurs

getParentParser

protected PofBufferReader getParentParser()
If this parser is contextually within a user type, obtain the parser which created this parser in order to parse the user type.
Overrides:
getParentParser in class PofBufferReader
Returns:
the parser for the context within which this parser is operating

Skip navigation links

Oracle® Coherence Java API Reference
Release 3.7.1.0

E22843-01


Copyright © 2000, 2011, Oracle and/or its affiliates. All rights reserved.