Class PofBufferReader
- All Implemented Interfaces:
PofConstants,PofReader
- Direct Known Subclasses:
PofBufferReader.UserTypeReader
PofReader implementation that reads POF-encoded data from a
BufferInput.- Since:
- Coherence 3.2
- Author:
- cp 2006.07.14
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classThe UserTypeReader implementation is a contextually-aware PofReader whose purpose is to advance through the properties of a value of a specified user type.Nested classes/interfaces inherited from class com.tangosol.io.pof.PofHelper
PofHelper.ReadableEntrySetMap, PofHelper.WriteableEntrySetMapNested classes/interfaces inherited from class com.tangosol.util.Base
Base.LoggingWriter -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected LongArrayLazily-constructed mapping of identities to references.protected PofContextThe PofContext to use to realize user data types as Java objects.protected ReadBuffer.BufferInputThe BufferInput containing the POF stream.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_EMPTYFields 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_USFields 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
ConstructorsModifierConstructorDescriptionprotectedConstruct a new PofBufferReader that will read a POF stream from the passed BufferInput object. -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanadvanceTo(int iProp) Advance through the POF stream until the specified property is found.protected voidcomplete(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.protected LongArrayObtain the registry for identity-reference pairs, creating it if necessary.protected PofBufferReaderIf this parser is contextually within a user type, obtain the parser which created this parser in order to parse the user type.Return the PofContext object used by this PofReader to deserialize user types from a POF stream.intDetermine the user type that is currently being parsed.intDetermine the version identifier of the user type that is currently being parsed.protected ObjectlookupIdentity(int nId) Look up the specified identity and return the object to which it refers.<T> T[]readArray(int iProp, IntFunction<T[]> supplier) Read an array of values.protected ObjectreadAsObject(int nType) Read a POF value as an Object.protected Object[]readAsObjectArray(int nType, Object[] ao) Read a POF value as an Object array.protected <T> T[]readAsTypedObjectArray(int nType, IntFunction<T[]> factory) Read a POF value as an Object array.protected ObjectreadAsUniformObject(int nType) Read a POF value in a uniform array/map as an Object.readBigDecimal(int iProp) Read a BigDecimal from the POF stream.readBigInteger(int iProp) Read a BigInteger from the POF stream.readBinary(int iProp) Read a Binary from the POF stream.protected static BinaryRead a Binary object from the specified BufferInput in an optimal way, depending on the existence of an enclosing ReadBuffer.booleanreadBoolean(int iProp) Read a boolean property from the POF stream.boolean[]readBooleanArray(int iProp) Read a boolean[] property from the POF stream.bytereadByte(int iProp) Read a byte property from the POF stream.byte[]readByteArray(int iProp) Read a byte[] property from the POF stream.charreadChar(int iProp) Read a char property from the POF stream.char[]readCharArray(int iProp) Read a char[] property from the POF stream.<T,C extends Collection<T>>
CreadCollection(int iProp, C coll) Read a Collection of object values from the POF stream.readDate(int iProp) Read a java.util.Date from the POF stream.doublereadDouble(int iProp) Read a double property from the POF stream.double[]readDoubleArray(int iProp) Read a double[] property from the POF stream.floatreadFloat(int iProp) Read a float property from the POF stream.float[]readFloatArray(int iProp) Read a float[] property from the POF stream.intreadInt(int iProp) Read a int property from the POF stream.int[]readIntArray(int iProp) Read a int[] property from the POF stream.readLocalDate(int iProp) Read a java.time.LocalDate from the POF stream.readLocalDateTime(int iProp) Read a java.time.LocalDateTime from the POF stream.readLocalTime(int iProp) Read a java.time.LocalTime from the POF stream.longreadLong(int iProp) Read a long property from the POF stream.long[]readLongArray(int iProp) Read a long[] property from the POF stream.readLongArray(int iProp, LongArray array) Read a LongArray of object values.<K,V, M extends Map<K, V>>
MreadMap(int iProp, M map) Read a Map of key/value pairs from the POF stream.<T> TreadObject(int iProp) Read a property of any type, including a user type, from the POF stream.Object[]readObjectArray(int iProp, Object[] ao) Read an array of object values.readOffsetDateTime(int iProp) Read a java.time.OffsetDateTime from the POF stream.readOffsetTime(int iProp) Read a java.time.OffsetTime from the POF stream.readRawDate(int iProp) Read a RawDate from the POF stream.readRawDateTime(int iProp) Read a RawDateTime from the POF stream.readRawDayTimeInterval(int iProp) Read a RawDayTimeInterval from the POF stream.readRawQuad(int iProp) Read a RawQuad from the POF stream.readRawTime(int iProp) Read a RawTime from the POF stream.readRawTimeInterval(int iProp) Read a RawTimeInterval from the POF stream.readRawYearMonthInterval(int iProp) Read a RawYearMonthInterval from the POF stream.Read all remaining indexed properties of the current user type from the POF stream.shortreadShort(int iProp) Read a short property from the POF stream.short[]readShortArray(int iProp) Read a short[] property from the POF stream.readString(int iProp) Read a String from the POF stream.protected voidregisterIdentity(int nId, Object oValue) Register the passed value with the passed identity.voidRegister an identity for a newly created user type instance.voidsetPofContext(PofContext ctx) Configure the PofContext object used by this PofReader to deserialize user types from a POF stream.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, writeTimeMethods 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, waitMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.tangosol.io.pof.PofReader
readZonedDateTime
-
Field Details
-
m_in
The BufferInput containing the POF stream. -
m_ctx
The PofContext to use to realize user data types as Java objects. -
m_arrayRefs
Lazily-constructed mapping of identities to references.
-
-
Constructor Details
-
PofBufferReader
Construct a new PofBufferReader that will read a POF stream from the passed BufferInput object.- Parameters:
in- a BufferInput objectctx- the PofContext
-
PofBufferReader
protected PofBufferReader()
-
-
Method Details
-
readBoolean
Read a boolean property from the POF stream.- Specified by:
readBooleanin interfacePofReader- Parameters:
iProp- the property index to read- Returns:
- the boolean property value, or zero if no value was available in the POF stream
- Throws:
IOException- if an I/O error occurs
-
readByte
Read a byte property from the POF stream.- Specified by:
readBytein interfacePofReader- Parameters:
iProp- the property index to read- Returns:
- the byte property value, or zero if no value was available in the POF stream
- Throws:
IOException- if an I/O error occurs
-
readChar
Read a char property from the POF stream.- Specified by:
readCharin interfacePofReader- Parameters:
iProp- the property index to read- Returns:
- the char property value, or zero if no value was available in the POF stream
- Throws:
IOException- if an I/O error occurs
-
readShort
Read a short property from the POF stream.- Specified by:
readShortin interfacePofReader- Parameters:
iProp- the property index to read- Returns:
- the short property value, or zero if no value was available in the POF stream
- Throws:
IOException- if an I/O error occurs
-
readInt
Read a int property from the POF stream.- Specified by:
readIntin interfacePofReader- Parameters:
iProp- the property index to read- Returns:
- the int property value, or zero if no value was available in the POF stream
- Throws:
IOException- if an I/O error occurs
-
readLong
Read a long property from the POF stream.- Specified by:
readLongin interfacePofReader- Parameters:
iProp- the property index to read- Returns:
- the long property value, or zero if no value was available in the POF stream
- Throws:
IOException- if an I/O error occurs
-
readFloat
Read a float property from the POF stream.- Specified by:
readFloatin interfacePofReader- Parameters:
iProp- the property index to read- Returns:
- the float property value, or zero if no value was available in the POF stream
- Throws:
IOException- if an I/O error occurs
-
readDouble
Read a double property from the POF stream.- Specified by:
readDoublein interfacePofReader- Parameters:
iProp- the property index to read- Returns:
- the double property value, or zero if no value was available in the POF stream
- Throws:
IOException- if an I/O error occurs
-
readBooleanArray
Read a boolean[] property from the POF stream.- Specified by:
readBooleanArrayin interfacePofReader- Parameters:
iProp- the property index to read- Returns:
- the boolean[] property value; may be null
- Throws:
IOException- if an I/O error occurs
-
readByteArray
Read a byte[] property from the POF stream.- Specified by:
readByteArrayin interfacePofReader- Parameters:
iProp- the property index to read- Returns:
- the byte[] property value; may be null
- Throws:
IOException- if an I/O error occurs
-
readCharArray
Read a char[] property from the POF stream.- Specified by:
readCharArrayin interfacePofReader- Parameters:
iProp- the property index to read- Returns:
- the char[] property value; may be null
- Throws:
IOException- if an I/O error occurs
-
readShortArray
Read a short[] property from the POF stream.- Specified by:
readShortArrayin interfacePofReader- Parameters:
iProp- the property index to read- Returns:
- the short[] property value; may be null
- Throws:
IOException- if an I/O error occurs
-
readIntArray
Read a int[] property from the POF stream.- Specified by:
readIntArrayin interfacePofReader- Parameters:
iProp- the property index to read- Returns:
- the int[] property value; may be null
- Throws:
IOException- if an I/O error occurs
-
readLongArray
Read a long[] property from the POF stream.- Specified by:
readLongArrayin interfacePofReader- Parameters:
iProp- the property index to read- Returns:
- the long[] property value; may be null
- Throws:
IOException- if an I/O error occurs
-
readFloatArray
Read a float[] property from the POF stream.- Specified by:
readFloatArrayin interfacePofReader- Parameters:
iProp- the property index to read- Returns:
- the float[] property value; may be null
- Throws:
IOException- if an I/O error occurs
-
readDoubleArray
Read a double[] property from the POF stream.- Specified by:
readDoubleArrayin interfacePofReader- Parameters:
iProp- the property index to read- Returns:
- the double[] property value; may be null
- Throws:
IOException- if an I/O error occurs
-
readBigInteger
Read a BigInteger from the POF stream.- Specified by:
readBigIntegerin interfacePofReader- Parameters:
iProp- the property index to read- Returns:
- the BigInteger property value, or null if no value was available in the POF stream
- Throws:
IOException- if an I/O error occurs
-
readRawQuad
Read a RawQuad from the POF stream.- Specified by:
readRawQuadin interfacePofReader- Parameters:
iProp- the property index to read- Returns:
- the RawQuad property value, or null if no value was available in the POF stream
- Throws:
IOException- if an I/O error occurs
-
readBigDecimal
Read a BigDecimal from the POF stream.- Specified by:
readBigDecimalin interfacePofReader- Parameters:
iProp- the property index to read- Returns:
- the BigDecimal property value, or null if no value was available in the POF stream
- Throws:
IOException- if an I/O error occurs
-
readBinary
Read a Binary from the POF stream.- Specified by:
readBinaryin interfacePofReader- Parameters:
iProp- the property index to read- Returns:
- the Binary property value, or null if no value was available in the POF stream
- Throws:
IOException- if an I/O error occurs
-
readString
Read a String from the POF stream.- Specified by:
readStringin interfacePofReader- Parameters:
iProp- the property index to read- Returns:
- the String property value, or null if no value was available in the POF stream
- Throws:
IOException- if an I/O error occurs
-
readDate
Read a java.util.Date from the POF stream.- Specified by:
readDatein interfacePofReader- Parameters:
iProp- the property index to read- Returns:
- the Date property value, or null if no value was available in the POF stream
- Throws:
IOException- if an I/O error occurs
-
readLocalDate
Description copied from interface:PofReaderRead a java.time.LocalDate from the POF stream.- Specified by:
readLocalDatein interfacePofReader- Parameters:
iProp- the property index to read- Returns:
- the LocalDate property value, or null if no value was available in the POF stream
- Throws:
IOException- if an I/O error occurs
-
readLocalDateTime
Description copied from interface:PofReaderRead a java.time.LocalDateTime from the POF stream.- Specified by:
readLocalDateTimein interfacePofReader- Parameters:
iProp- the property index to read- Returns:
- the LocalDateTime property value, or null if no value was available in the POF stream
- Throws:
IOException- if an I/O error occurs
-
readLocalTime
Description copied from interface:PofReaderRead a java.time.LocalTime from the POF stream.- Specified by:
readLocalTimein interfacePofReader- Parameters:
iProp- the property index to read- Returns:
- the LocalTime property value, or null if no value was available in the POF stream
- Throws:
IOException- if an I/O error occurs
-
readOffsetDateTime
Description copied from interface:PofReaderRead a java.time.OffsetDateTime from the POF stream.- Specified by:
readOffsetDateTimein interfacePofReader- Parameters:
iProp- the property index to read- Returns:
- the OffsetDateTime property value, or null if no value was available in the POF stream
- Throws:
IOException- if an I/O error occurs
-
readOffsetTime
Description copied from interface:PofReaderRead a java.time.OffsetTime from the POF stream.- Specified by:
readOffsetTimein interfacePofReader- Parameters:
iProp- the property index to read- Returns:
- the OffsetTime property value, or null if no value was available in the POF stream
- Throws:
IOException- if an I/O error occurs
-
readRawDate
Read a RawDate from the POF stream. TheRawDateclass contains the raw date information that was carried in the POF stream.- Specified by:
readRawDatein interfacePofReader- Parameters:
iProp- the property index to read- Returns:
- the RawDate property value, or null if no value was available in the POF stream
- Throws:
IOException- if an I/O error occurs
-
readRawTime
Read a RawTime from the POF stream. TheRawTimeclass contains the raw time information that was carried in the POF stream, including raw timezone information.- Specified by:
readRawTimein interfacePofReader- Parameters:
iProp- the property index to read- Returns:
- the RawTime property value, or null if no value was available in the POF stream
- Throws:
IOException- if an I/O error occurs
-
readRawDateTime
Read a RawDateTime from the POF stream. TheRawDateTimeclass contains the raw date and time information that was carried in the POF stream, including raw timezone information.- Specified by:
readRawDateTimein interfacePofReader- Parameters:
iProp- the property index to read- Returns:
- the RawDateTime property value, or null if no value was available in the POF stream
- Throws:
IOException- if an I/O error occurs
-
readRawYearMonthInterval
Read a RawYearMonthInterval from the POF stream. TheRawYearMonthIntervalclass contains the raw year-month interval information that was carried in the POF stream.- Specified by:
readRawYearMonthIntervalin interfacePofReader- Parameters:
iProp- the property index to read- Returns:
- the RawYearMonthInterval property value, or null if no value was available in the POF stream
- Throws:
IOException- if an I/O error occurs
-
readRawTimeInterval
Read a RawTimeInterval from the POF stream. TheRawTimeIntervalclass contains the raw time interval information that was carried in the POF stream.- Specified by:
readRawTimeIntervalin interfacePofReader- Parameters:
iProp- the property index to read- Returns:
- the RawTimeInterval property value, or null if no value was available in the POF stream
- Throws:
IOException- if an I/O error occurs
-
readRawDayTimeInterval
Read a RawDayTimeInterval from the POF stream. TheRawDayTimeIntervalclass contains the raw year-month interval information that was carried in the POF stream.- Specified by:
readRawDayTimeIntervalin interfacePofReader- Parameters:
iProp- the property index to read- Returns:
- the RawDayTimeInterval property value, or null if no value was available in the POF stream
- Throws:
IOException- if an I/O error occurs
-
readObjectArray
Read an array of object values.- Specified by:
readObjectArrayin interfacePofReader- Parameters:
iProp- the property index to readao- the optional array to use to store the values, or to use as a typed template for creating an array to store the values, following the documentation forCollection.toArray()- Returns:
- an array of object values, or null if no array is passed and there is no array data in the POF stream
- Throws:
IOException- if an I/O error occurs
-
readArray
Read an array of values.- Specified by:
readArrayin interfacePofReader- Type Parameters:
T- the value type- Parameters:
iProp- the property index to readsupplier- the supplier to use to create the array, typically an array constructor reference (i.e.String[]::new)- Returns:
- an array of object values, or an empty array if there is no array data in the POF stream
- Throws:
IOException- if an I/O error occurs
-
readLongArray
Read a LongArray of object values.- Specified by:
readLongArrayin interfacePofReader- Parameters:
iProp- the property index to readarray- the optional LongArray object to use to store the values- Returns:
- a LongArray of object values, or null if no LongArray is passed and there is no array data in the POF stream
- Throws:
IOException- if an I/O error occurs
-
readCollection
Read a Collection of object values from the POF stream.- Specified by:
readCollectionin interfacePofReader- Type Parameters:
T- the object value typeC- the collection type- Parameters:
iProp- the property index to readcoll- the optional Collection to use to store the values- Returns:
- a Collection of object values, or null if no Collection is passed and there is no collection data in the POF stream
- Throws:
IOException- if an I/O error occurs
-
readMap
Read a Map of key/value pairs from the POF stream.- Specified by:
readMapin interfacePofReader- Type Parameters:
K- the key typeV- the value typeM- the map type- Parameters:
iProp- the property index to readmap- the optional Map to initialize- Returns:
- a Map of key/value pairs object values, or null if no Map is passed and there is no key/value data in the POF stream
- Throws:
IOException- if an I/O error occurs
-
getPofContext
Return the PofContext object used by this PofReader to deserialize user types from a POF stream.- Specified by:
getPofContextin interfacePofReader- Returns:
- the PofContext object that contains user type meta-data
-
setPofContext
Configure the PofContext object used by this PofReader to deserialize user types from a POF stream.Note: this is an advanced method that should be used with care. For example, if this method is being used to switch to another PofContext mid-POF stream, it is important to eventually restore the original PofContext. For example:
PofContext ctxOrig = reader.getPofContext(); try { // switch to another PofContext PofContext ctxNew = ...; reader.setContext(ctxNew); // read POF data using the reader } finally { // restore the original PofContext reader.setPofContext(ctxOrig); }- Specified by:
setPofContextin interfacePofReader- Parameters:
ctx- the new PofContext; must not be null
-
readObject
Read a property of any type, including a user type, from the POF stream.- Specified by:
readObjectin interfacePofReader- Type Parameters:
T- the object type- Parameters:
iProp- the property index to read- Returns:
- the Object value; may be null
- Throws:
IOException- if an I/O error occurs
-
getUserTypeId
public int getUserTypeId()Determine the user type that is currently being parsed.- Specified by:
getUserTypeIdin interfacePofReader- 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:
getVersionIdin interfacePofReader- 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:
registerIdentityin interfacePofReader- 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:
createNestedPofReaderin interfacePofReader- 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:
readRemainderin interfacePofReader- Returns:
- a Binary object containing zero or more indexed properties in binary POF encoded form
- 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.- Parameters:
iProp- the index of the property to advance to- Returns:
- true if the property is found
- Throws:
IllegalStateException- if the POF stream has already advanced past the desired propertyIOException- if an I/O error occurs
-
complete
Register the completion of the parsing of a value.- Parameters:
iProp- the property index- 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.- Returns:
- the parser for the context within which this parser is operating
-
ensureReferenceRegistry
Obtain the registry for identity-reference pairs, creating it if necessary.- Returns:
- the identity-reference registry, never null
-
registerIdentity
Register the passed value with the passed identity.- Parameters:
nId- the identity within the POF stream of the objectoValue- the object to associate with the passed identity- Throws:
IllegalArgumentException- if the specified identity is already registered with a different object
-
lookupIdentity
Look up the specified identity and return the object to which it refers.- Parameters:
nId- the identity- Returns:
- the object registered under that identity
- Throws:
IOException- if the requested identity is not registered
-
readAsObject
Read a POF value as an Object.- Parameters:
nType- the type identifier of the value- Returns:
- an Object value
- Throws:
IOException- if an I/O error occurs
-
readAsUniformObject
Read a POF value in a uniform array/map as an Object.- Parameters:
nType- the type identifier of the value- Returns:
- an Object value
- Throws:
IOException- if an I/O error occurs
-
readAsObjectArray
Read a POF value as an Object array.- Parameters:
nType- the type identifier of the valueao- the optional array to use to store the values, or to use as a typed template for creating an array to store the values, following the documentation forCollection.toArray()- Returns:
- an Object array
- Throws:
IOException- if an I/O error occurs
-
readAsTypedObjectArray
Read a POF value as an Object array.- Type Parameters:
T- the identifier type- Parameters:
nType- the type identifier of the valuefactory- the optional factory to use to initialize the array- Returns:
- an Object array
- Throws:
IOException- if an I/O error occurs
-
readBinary
Read a Binary object from the specified BufferInput in an optimal way, depending on the existence of an enclosing ReadBuffer.- Parameters:
in- a BufferInput to read from- Returns:
- a Binary object
- Throws:
IOException- if an I/O error occurs
-