Interface PofReader
- All Known Implementing Classes:
PofBufferReader
,PofBufferReader.UserTypeReader
See PofWriter
for a complete description of the POF user type
serialization format.
- Since:
- Coherence 3.2
- Author:
- cp/jh 2006.07.13
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptioncreateNestedPofReader
(int iProp) Obtain a PofReader that can be used to read a set of properties from a single property of the current user type.Return the PofContext object used by this PofReader to deserialize user types from a POF stream.int
Determine the user type that is currently being parsed.int
Determine the version identifier of the user type that is currently being parsed.<T> T[]
readArray
(int iProp, IntFunction<T[]> supplier) Read an array of values.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.boolean
readBoolean
(int iProp) Read a boolean property from the POF stream.boolean[]
readBooleanArray
(int iProp) Read a boolean[] property from the POF stream.byte
readByte
(int iProp) Read a byte property from the POF stream.byte[]
readByteArray
(int iProp) Read a byte[] property from the POF stream.char
readChar
(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.double
readDouble
(int iProp) Read a double property from the POF stream.double[]
readDoubleArray
(int iProp) Read a double[] property from the POF stream.float
readFloat
(int iProp) Read a float property from the POF stream.float[]
readFloatArray
(int iProp) Read a float[] property from the POF stream.int
readInt
(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.long
readLong
(int iProp) Read a long property from the POF stream.long[]
readLongArray
(int iProp) Read a long[] property from the POF stream.<T> LongArray
<T> readLongArray
(int iProp, LongArray<T> 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> T
readObject
(int iProp) Read a property of any type, including a user type, from the POF stream.Object[]
readObjectArray
(int iProp, Object[] ao) Deprecated.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.short
readShort
(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.default ZonedDateTime
readZonedDateTime
(int iProp) Read a java.time.ZonedDateTime from the POF stream.void
Register an identity for a newly created user type instance.void
setPofContext
(PofContext ctx) Configure the PofContext object used by this PofReader to deserialize user types from a POF stream.
-
Method Details
-
readBoolean
Read a boolean property from the POF stream.- Parameters:
iProp
- the property index to read- Returns:
- the boolean property value, or zero if no value was available in the POF stream
- Throws:
IllegalStateException
- if the POF stream has already advanced past the desired propertyIOException
- if an I/O error occurs
-
readByte
Read a byte property from the POF stream.- Parameters:
iProp
- the property index to read- Returns:
- the byte property value, or zero if no value was available in the POF stream
- Throws:
IllegalStateException
- if the POF stream has already advanced past the desired propertyIOException
- if an I/O error occurs
-
readChar
Read a char property from the POF stream.- Parameters:
iProp
- the property index to read- Returns:
- the char property value, or zero if no value was available in the POF stream
- Throws:
IllegalStateException
- if the POF stream has already advanced past the desired propertyIOException
- if an I/O error occurs
-
readShort
Read a short property from the POF stream.- Parameters:
iProp
- the property index to read- Returns:
- the short property value, or zero if no value was available in the POF stream
- Throws:
IllegalStateException
- if the POF stream has already advanced past the desired propertyIOException
- if an I/O error occurs
-
readInt
Read a int property from the POF stream.- Parameters:
iProp
- the property index to read- Returns:
- the int property value, or zero if no value was available in the POF stream
- Throws:
IllegalStateException
- if the POF stream has already advanced past the desired propertyIOException
- if an I/O error occurs
-
readLong
Read a long property from the POF stream.- Parameters:
iProp
- the property index to read- Returns:
- the long property value, or zero if no value was available in the POF stream
- Throws:
IllegalStateException
- if the POF stream has already advanced past the desired propertyIOException
- if an I/O error occurs
-
readFloat
Read a float property from the POF stream.- Parameters:
iProp
- the property index to read- Returns:
- the float property value, or zero if no value was available in the POF stream
- Throws:
IllegalStateException
- if the POF stream has already advanced past the desired propertyIOException
- if an I/O error occurs
-
readDouble
Read a double property from the POF stream.- Parameters:
iProp
- the property index to read- Returns:
- the double property value, or zero if no value was available in the POF stream
- Throws:
IllegalStateException
- if the POF stream has already advanced past the desired propertyIOException
- if an I/O error occurs
-
readBooleanArray
Read a boolean[] property from the POF stream.- Parameters:
iProp
- the property index to read- Returns:
- the boolean[] property value; may be null
- Throws:
IllegalStateException
- if the POF stream has already advanced past the desired propertyIOException
- if an I/O error occurs
-
readByteArray
Read a byte[] property from the POF stream.- Parameters:
iProp
- the property index to read- Returns:
- the byte[] property value; may be null
- Throws:
IllegalStateException
- if the POF stream has already advanced past the desired propertyIOException
- if an I/O error occurs
-
readCharArray
Read a char[] property from the POF stream.- Parameters:
iProp
- the property index to read- Returns:
- the char[] property value; may be null
- Throws:
IllegalStateException
- if the POF stream has already advanced past the desired propertyIOException
- if an I/O error occurs
-
readShortArray
Read a short[] property from the POF stream.- Parameters:
iProp
- the property index to read- Returns:
- the short[] property value; may be null
- Throws:
IllegalStateException
- if the POF stream has already advanced past the desired propertyIOException
- if an I/O error occurs
-
readIntArray
Read a int[] property from the POF stream.- Parameters:
iProp
- the property index to read- Returns:
- the int[] property value; may be null
- Throws:
IllegalStateException
- if the POF stream has already advanced past the desired propertyIOException
- if an I/O error occurs
-
readLongArray
Read a long[] property from the POF stream.- Parameters:
iProp
- the property index to read- Returns:
- the long[] property value; may be null
- Throws:
IllegalStateException
- if the POF stream has already advanced past the desired propertyIOException
- if an I/O error occurs
-
readFloatArray
Read a float[] property from the POF stream.- Parameters:
iProp
- the property index to read- Returns:
- the float[] property value; may be null
- Throws:
IllegalStateException
- if the POF stream has already advanced past the desired propertyIOException
- if an I/O error occurs
-
readDoubleArray
Read a double[] property from the POF stream.- Parameters:
iProp
- the property index to read- Returns:
- the double[] property value; may be null
- Throws:
IllegalStateException
- if the POF stream has already advanced past the desired propertyIOException
- if an I/O error occurs
-
readBigInteger
Read a BigInteger from the POF stream.- Parameters:
iProp
- the property index to read- Returns:
- the BigInteger property value, or null if no value was available in the POF stream
- Throws:
IllegalStateException
- if the POF stream has already advanced past the desired propertyIOException
- if an I/O error occurs
-
readRawQuad
Read a RawQuad from the POF stream.- Parameters:
iProp
- the property index to read- Returns:
- the RawQuad property value, or null if no value was available in the POF stream
- Throws:
IllegalStateException
- if the POF stream has already advanced past the desired propertyIOException
- if an I/O error occurs
-
readBigDecimal
Read a BigDecimal from the POF stream.- Parameters:
iProp
- the property index to read- Returns:
- the BigDecimal property value, or null if no value was available in the POF stream
- Throws:
IllegalStateException
- if the POF stream has already advanced past the desired propertyIOException
- if an I/O error occurs
-
readBinary
Read a Binary from the POF stream.- Parameters:
iProp
- the property index to read- Returns:
- the Binary property value, or null if no value was available in the POF stream
- Throws:
IllegalStateException
- if the POF stream has already advanced past the desired propertyIOException
- if an I/O error occurs
-
readString
Read a String from the POF stream.- Parameters:
iProp
- the property index to read- Returns:
- the String property value, or null if no value was available in the POF stream
- Throws:
IllegalStateException
- if the POF stream has already advanced past the desired propertyIOException
- if an I/O error occurs
-
readDate
Read a java.util.Date from the POF stream.- Parameters:
iProp
- the property index to read- Returns:
- the Date property value, or null if no value was available in the POF stream
- Throws:
IllegalStateException
- if the POF stream has already advanced past the desired propertyIOException
- if an I/O error occurs
-
readLocalDate
Read a java.time.LocalDate from the POF stream.- Parameters:
iProp
- the property index to read- Returns:
- the LocalDate property value, or null if no value was available in the POF stream
- Throws:
IllegalStateException
- if the POF stream has already advanced past the desired propertyIOException
- if an I/O error occurs
-
readLocalDateTime
Read a java.time.LocalDateTime from the POF stream.- Parameters:
iProp
- the property index to read- Returns:
- the LocalDateTime property value, or null if no value was available in the POF stream
- Throws:
IllegalStateException
- if the POF stream has already advanced past the desired propertyIOException
- if an I/O error occurs
-
readLocalTime
Read a java.time.LocalTime from the POF stream.- Parameters:
iProp
- the property index to read- Returns:
- the LocalTime property value, or null if no value was available in the POF stream
- Throws:
IllegalStateException
- if the POF stream has already advanced past the desired propertyIOException
- if an I/O error occurs
-
readOffsetDateTime
Read a java.time.OffsetDateTime from the POF stream.- Parameters:
iProp
- the property index to read- Returns:
- the OffsetDateTime property value, or null if no value was available in the POF stream
- Throws:
IllegalStateException
- if the POF stream has already advanced past the desired propertyIOException
- if an I/O error occurs
-
readOffsetTime
Read a java.time.OffsetTime from the POF stream.- Parameters:
iProp
- the property index to read- Returns:
- the OffsetTime property value, or null if no value was available in the POF stream
- Throws:
IllegalStateException
- if the POF stream has already advanced past the desired propertyIOException
- if an I/O error occurs
-
readZonedDateTime
Read a java.time.ZonedDateTime from the POF stream.- Parameters:
iProp
- the property index to read- Returns:
- the ZonedDateTime property value, or null if no value was available in the POF stream
- Throws:
IllegalStateException
- if the POF stream has already advanced past the desired propertyIOException
- if an I/O error occurs
-
readRawDate
Read a RawDate from the POF stream. TheRawDate
class contains the raw date information that was carried in the POF stream.- Parameters:
iProp
- the property index to read- Returns:
- the RawDate property value, or null if no value was available in the POF stream
- Throws:
IllegalStateException
- if the POF stream has already advanced past the desired propertyIOException
- if an I/O error occurs
-
readRawTime
Read a RawTime from the POF stream. TheRawTime
class contains the raw time information that was carried in the POF stream, including raw timezone information.- Parameters:
iProp
- the property index to read- Returns:
- the RawTime property value, or null if no value was available in the POF stream
- Throws:
IllegalStateException
- if the POF stream has already advanced past the desired propertyIOException
- if an I/O error occurs
-
readRawDateTime
Read a RawDateTime from the POF stream. TheRawDateTime
class contains the raw date and time information that was carried in the POF stream, including raw timezone information.- Parameters:
iProp
- the property index to read- Returns:
- the RawDateTime property value, or null if no value was available in the POF stream
- Throws:
IllegalStateException
- if the POF stream has already advanced past the desired propertyIOException
- if an I/O error occurs
-
readRawYearMonthInterval
Read a RawYearMonthInterval from the POF stream. TheRawYearMonthInterval
class contains the raw year-month interval information that was carried in the POF stream.- Parameters:
iProp
- the property index to read- Returns:
- the RawYearMonthInterval property value, or null if no value was available in the POF stream
- Throws:
IllegalStateException
- if the POF stream has already advanced past the desired propertyIOException
- if an I/O error occurs
-
readRawTimeInterval
Read a RawTimeInterval from the POF stream. TheRawTimeInterval
class contains the raw time interval information that was carried in the POF stream.- Parameters:
iProp
- the property index to read- Returns:
- the RawTimeInterval property value, or null if no value was available in the POF stream
- Throws:
IllegalStateException
- if the POF stream has already advanced past the desired propertyIOException
- if an I/O error occurs
-
readRawDayTimeInterval
Read a RawDayTimeInterval from the POF stream. TheRawDayTimeInterval
class contains the raw year-month interval information that was carried in the POF stream.- Parameters:
iProp
- the property index to read- Returns:
- the RawDayTimeInterval property value, or null if no value was available in the POF stream
- Throws:
IllegalStateException
- if the POF stream has already advanced past the desired propertyIOException
- if an I/O error occurs
-
readObject
Read a property of any type, including a user type, from the POF stream.- Type Parameters:
T
- the object type- Parameters:
iProp
- the property index to read- Returns:
- the Object value; may be null
- Throws:
IllegalStateException
- if the POF stream has already advanced past the desired propertyIOException
- if an I/O error occurs
-
readObjectArray
Deprecated.Read an array of object values.- 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:
IllegalStateException
- if the POF stream has already advanced past the desired propertyIOException
- if an I/O error occurs
-
readArray
Read an array of values.- 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:
IllegalStateException
- if the POF stream has already advanced past the desired propertyIOException
- if an I/O error occurs
-
readLongArray
Read a LongArray of object values.- Type Parameters:
T
- the object value type- 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:
IllegalStateException
- if the POF stream has already advanced past the desired propertyIOException
- if an I/O error occurs
-
readCollection
Read a Collection of object values from the POF stream.- 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:
IllegalStateException
- if the POF stream has already advanced past the desired propertyIOException
- if an I/O error occurs
-
readMap
Read a Map of key/value pairs from the POF stream.- 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:
IllegalStateException
- if the POF stream has already advanced past the desired propertyIOException
- if an I/O error occurs
-
getPofContext
PofContext getPofContext()Return the PofContext object used by this PofReader to deserialize user types from a POF stream.- 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); }
- Parameters:
ctx
- the new PofContext; must not be null
-
getUserTypeId
int getUserTypeId()Determine the user type that is currently being parsed.- Returns:
- the user type information, or -1 if the PofReader is not currently parsing a user type
-
getVersionId
int getVersionId()Determine the version identifier of the user type that is currently being parsed.- Returns:
- the integer version ID read from the POF stream; always non-negative
- Throws:
IllegalStateException
- if no user type is being parsed
-
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.
- Parameters:
o
- the object to register the identity for- Since:
- Coherence 3.7.1
- 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.- Parameters:
iProp
- the property index to read from- Returns:
- a PofReader that reads its contents from a single property of this PofReader
- Throws:
IllegalStateException
- if the POF stream has already advanced past the desired property or if no user type is being parsed.IOException
- if an I/O error occurs- Since:
- Coherence 3.6
-
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.
- Returns:
- a Binary object containing zero or more indexed properties in binary POF encoded form
- Throws:
IllegalStateException
- if no user type is being parsedIOException
- if an I/O error occurs
-