Package com.tangosol.io.pof
Class PofBufferReader.UserTypeReader
java.lang.Object
com.tangosol.util.Base
com.tangosol.io.pof.PofHelper
com.tangosol.io.pof.PofBufferReader
com.tangosol.io.pof.PofBufferReader.UserTypeReader
- All Implemented Interfaces:
PofConstants
,PofReader
- Enclosing class:
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
Nested classes/interfaces inherited from class com.tangosol.util.Base
Base.LoggingWriter
-
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 class com.tangosol.util.Base
LOG_ALWAYS, LOG_CONFIG, LOG_DEBUG, LOG_ERR, LOG_INFO, LOG_MAX, LOG_MIN, LOG_QUIET, LOG_WARN, POWER_0, POWER_G, POWER_K, POWER_M, POWER_T, UNIT_D, UNIT_H, UNIT_M, UNIT_MS, UNIT_NS, UNIT_S, UNIT_US
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_LOCAL_DATE, J_LOCAL_DATETIME, J_LOCAL_TIME, J_LONG, J_LONG_ARRAY, J_MAP, J_NULL, J_OBJECT_ARRAY, J_OFFSET_DATETIME, J_OFFSET_TIME, 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, J_ZONED_DATETIME, 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
ConstructorDescriptionUserTypeReader
(PofBufferReader parent, ReadBuffer.BufferInput in, PofContext ctx, int nTypeId, int nVersionId) Construct a parser for parsing the property values of a user type.UserTypeReader
(ReadBuffer.BufferInput in, PofContext ctx, int nTypeId, int nVersionId) Construct a parser for parsing the property values of a user type. -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
advanceTo
(int iProp) Advance through the POF stream until the specified property is found.protected void
Notify the UserTypeReader that it is being "closed".protected void
complete
(int iProp) Register the completion of the parsing of a value.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.int
Return the index of the next property in the POF stream.protected PofBufferReader
If this parser is contextually within a user type, obtain the parser which created this parser in order to parse the user type.int
Return the index of the most recent property read or (if it were missing) requested.int
Determine the user type that is currently being parsed.int
Determine the version identifier of the user type that is currently being parsed.Read all remaining indexed properties of the current user type from the POF stream.void
Register an identity for a newly created user type instance.Methods inherited from class com.tangosol.io.pof.PofBufferReader
ensureReferenceRegistry, getPofContext, lookupIdentity, readArray, readAsObject, readAsObjectArray, readAsTypedObjectArray, readAsUniformObject, readBigDecimal, readBigInteger, readBinary, readBinary, readBoolean, readBooleanArray, readByte, readByteArray, readChar, readCharArray, readCollection, readDate, readDouble, readDoubleArray, readFloat, readFloatArray, readInt, readIntArray, readLocalDate, readLocalDateTime, readLocalTime, readLong, readLongArray, readLongArray, readMap, readObject, readObjectArray, readOffsetDateTime, readOffsetTime, 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, readLocalDate, readLocalDateTime, readLocalTime, readOffsetDateTime, readOffsetTime, readQuad, readRawDate, readRawTime, resizeArray, skipPackedInts, skipUniformValue, skipValue, writeBigDecimal, writeBigInteger, writeDate, writeTime
Methods inherited from class com.tangosol.util.Base
azzert, azzert, azzert, azzertFailed, breakLines, breakLines, capitalize, checkNotEmpty, checkNotNull, checkRange, computeSafeWaitTime, decimalValue, dup, dup, ensureBigDecimal, ensureClassLoader, ensureRuntimeException, ensureRuntimeException, equals, equalsDeep, err, err, err, err, err, escape, formatDateTime, getCallerStackFrame, getCommonMonitor, getCommonMonitor, getCommonMonitor, getContextClassLoader, getContextClassLoader, getDeepMessage, getErr, getLastSafeTimeMillis, getLog, getMaxDecDigits, getMaxHexDigits, getOriginalException, getOut, getProcessRandom, getRandom, getRandomBinary, getRandomBinary, getRandomString, getSafeTimeMillis, getStackFrame, getStackFrames, getStackTrace, getStackTrace, getStackTrace, getThreadFactory, getTimeZone, getUpTimeMillis, hashCode, hexValue, indentString, indentString, isDecimal, isHex, isLogEcho, isOctal, log, log, log, log, log, makeInteger, makeLong, makeThread, mergeArray, mergeBooleanArray, mergeByteArray, mergeCharArray, mergeDoubleArray, mergeFloatArray, mergeIntArray, mergeLongArray, mod, mod, octalValue, out, out, out, out, out, pad, parseBandwidth, parseBandwidth, parseDelimitedString, parseHex, parseHex, parseMemorySize, parseMemorySize, parsePercentage, parseTime, parseTime, parseTimeNanos, parseTimeNanos, printStackTrace, randomize, randomize, randomize, randomize, read, read, read, read, read, read, read, replace, setErr, setLog, setLogEcho, setOut, sleep, toBandwidthString, toBandwidthString, toCharEscape, toCrc, toCrc, toCrc, toCrc, toCrc, toDecString, toDelimitedString, toDelimitedString, toDelimitedString, toDelimitedString, toHex, toHex, toHexDump, toHexEscape, toHexEscape, toHexEscape, toHexEscape, toHexString, toMemorySizeString, toMemorySizeString, toQuotedCharEscape, toQuotedStringEscape, toSqlString, toString, toString, toStringEscape, toUnicodeEscape, trace, trace, trace, trace, trace, trace, trace, trace, trace, truncateString, truncateString, wait
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.tangosol.io.pof.PofReader
readZonedDateTime
-
Constructor Details
-
UserTypeReader
public UserTypeReader(ReadBuffer.BufferInput in, PofContext ctx, int nTypeId, int nVersionId) throws 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 parsingnTypeId
- the type id of the user typenVersionId
- the version id of the user type- Throws:
IOException
- if an I/O error occurs
-
UserTypeReader
public UserTypeReader(PofBufferReader parent, ReadBuffer.BufferInput in, PofContext ctx, int nTypeId, int nVersionId) throws IOException Construct a parser for parsing the property values of a user type.- Parameters:
parent
- the parent (ie the containing) PofBufferReaderin
- 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 parsingnTypeId
- the type id of the user typenVersionId
- the version id of the user type- Throws:
IOException
- if an I/O error occurs
-
-
Method Details
-
getUserTypeId
public int getUserTypeId()Determine the user type that is currently being parsed.- Specified by:
getUserTypeId
in interfacePofReader
- Overrides:
getUserTypeId
in classPofBufferReader
- 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 interfacePofReader
- Overrides:
getVersionId
in classPofBufferReader
- Returns:
- the integer version ID read from the POF stream; always non-negative
-
registerIdentity
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 interfacePofReader
- Overrides:
registerIdentity
in classPofBufferReader
- Parameters:
o
- the object to register the identity for- See Also:
-
createNestedPofReader
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 interfacePofReader
- Overrides:
createNestedPofReader
in classPofBufferReader
- Parameters:
iProp
- the property index to read from- Returns:
- a PofReader that reads its contents from a single property of this PofReader
- Throws:
IOException
- if an I/O error occurs
-
readRemainder
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 interfacePofReader
- Overrides:
readRemainder
in classPofBufferReader
- Returns:
- a Binary object containing zero or more indexed properties in binary POF encoded form
- Throws:
IOException
- if an I/O error occurs
-
getPreviousPropertyIndex
public int getPreviousPropertyIndex()Return the index of the most recent property read or (if it were missing) requested.- Returns:
- the index of the most recent property read
-
getNextPropertyIndex
Return the index of the next property in the POF stream.- Returns:
- the index of the next property in the POF stream
- Throws:
IOException
- if an I/O error occurs
-
advanceTo
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 classPofBufferReader
- Parameters:
iProp
- the index of the property to advance to- Returns:
- true if the property is found
- Throws:
IOException
- if an I/O error occurs
-
complete
Register the completion of the parsing of a value.- Overrides:
complete
in classPofBufferReader
- Parameters:
iProp
- the property index- Throws:
IOException
- if an I/O error occurs
-
closeNested
Notify the UserTypeReader that it is being "closed".- Throws:
IOException
- if an I/O error occurs
-
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 classPofBufferReader
- Returns:
- the parser for the context within which this parser is operating
-