|
Oracle® Coherence Java API Reference Release 12.1.2.0.3 E26043-02 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
com.tangosol.util.Base
com.tangosol.io.pof.PofHelper
com.tangosol.io.pof.PofBufferReader
public class PofBufferReader
PofReader
implementation that reads POF-encoded data from a BufferInput
.
Nested Class Summary | |
---|---|
static class |
PofBufferReader.IdentityHolder |
static class |
PofBufferReader.UserTypeReader The 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.WriteableEntrySetMap |
Field Summary | |
---|---|
protected LongArray |
m_arrayRefs Lazily-constructed mapping of identities to references. |
protected PofContext |
m_ctx The PofContext to use to realize user data types as Java objects. |
protected ReadBuffer.BufferInput |
m_in The 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_EMPTY |
Constructor Summary | |
---|---|
protected |
PofBufferReader() |
|
PofBufferReader(ReadBuffer.BufferInput in, PofContext ctx) Construct a new PofBufferReader that will read a POF stream from the passed BufferInput object. |
Method Summary | |
---|---|
protected boolean |
advanceTo(int iProp) Advance through the POF stream until the specified property is found. |
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 LongArray |
ensureReferenceRegistry() Obtain the registry for identity-reference pairs, creating it if necessary. |
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. |
PofContext |
getPofContext() Return the PofContext object used by this PofReader to deserialize user types from a POF stream. |
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. |
protected java.lang.Object |
lookupIdentity(int nId) Look up the specified identity and return the object to which it refers. |
protected java.lang.Object |
readAsObject(int nType) Read a POF value as an Object. |
protected java.lang.Object[] |
readAsObjectArray(int nType, java.lang.Object[] ao) Read a POF value as an Object array. |
protected java.lang.Object |
readAsUniformObject(int nType) Read a POF value in a uniform array/map as an Object. |
java.math.BigDecimal |
readBigDecimal(int iProp) Read a BigDecimal from the POF stream. |
java.math.BigInteger |
readBigInteger(int iProp) Read a BigInteger from the POF stream. |
Binary |
readBinary(int iProp) Read a Binary from the POF stream. |
protected static Binary |
readBinary(ReadBuffer.BufferInput in) Read a Binary object from the specified BufferInput in an optimal way, depending on the existence of an enclosing ReadBuffer. |
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. |
java.util.Collection |
readCollection(int iProp, java.util.Collection coll) Read a Collection of object values from the POF stream. |
java.util.Date |
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. |
long |
readLong(int iProp) Read a long property from the POF stream. |
long[] |
readLongArray(int iProp) Read a long[] property from the POF stream. |
LongArray |
readLongArray(int iProp, LongArray array) Read a LongArray of object values. |
java.util.Map |
readMap(int iProp, java.util.Map map) Read a Map of key/value pairs from the POF stream. |
java.lang.Object |
readObject(int iProp) Read a property of any type, including a user type, from the POF stream. |
java.lang.Object[] |
readObjectArray(int iProp, java.lang.Object[] ao) Read an array of object values. |
RawDate |
readRawDate(int iProp) Read a RawDate from the POF stream. |
RawDateTime |
readRawDateTime(int iProp) Read a RawDateTime from the POF stream. |
RawDayTimeInterval |
readRawDayTimeInterval(int iProp) Read a RawDayTimeInterval from the POF stream. |
RawQuad |
readRawQuad(int iProp) Read a RawQuad from the POF stream. |
RawTime |
readRawTime(int iProp) Read a RawTime from the POF stream. |
RawTimeInterval |
readRawTimeInterval(int iProp) Read a RawTimeInterval from the POF stream. |
RawYearMonthInterval |
readRawYearMonthInterval(int iProp) Read a RawYearMonthInterval from the POF stream. |
Binary |
readRemainder() 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. |
java.lang.String |
readString(int iProp) Read a String from the POF stream. |
protected void |
registerIdentity(int nId, java.lang.Object oValue) Register the passed value with the passed identity. |
void |
registerIdentity(java.lang.Object o) 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. |
Field Detail |
---|
protected ReadBuffer.BufferInput m_in
protected PofContext m_ctx
protected LongArray m_arrayRefs
Constructor Detail |
---|
public PofBufferReader(ReadBuffer.BufferInput in, PofContext ctx)
in
- a BufferInput objectctx
- the PofContextprotected PofBufferReader()
Method Detail |
---|
public boolean readBoolean(int iProp) throws java.io.IOException
readBoolean
in interface PofReader
iProp
- the property index to readjava.io.IOException
- if an I/O error occurspublic byte readByte(int iProp) throws java.io.IOException
readByte
in interface PofReader
iProp
- the property index to readjava.io.IOException
- if an I/O error occurspublic char readChar(int iProp) throws java.io.IOException
readChar
in interface PofReader
iProp
- the property index to readjava.io.IOException
- if an I/O error occurspublic short readShort(int iProp) throws java.io.IOException
readShort
in interface PofReader
iProp
- the property index to readjava.io.IOException
- if an I/O error occurspublic int readInt(int iProp) throws java.io.IOException
readInt
in interface PofReader
iProp
- the property index to readjava.io.IOException
- if an I/O error occurspublic long readLong(int iProp) throws java.io.IOException
readLong
in interface PofReader
iProp
- the property index to readjava.io.IOException
- if an I/O error occurspublic float readFloat(int iProp) throws java.io.IOException
readFloat
in interface PofReader
iProp
- the property index to readjava.io.IOException
- if an I/O error occurspublic double readDouble(int iProp) throws java.io.IOException
readDouble
in interface PofReader
iProp
- the property index to readjava.io.IOException
- if an I/O error occurspublic boolean[] readBooleanArray(int iProp) throws java.io.IOException
readBooleanArray
in interface PofReader
iProp
- the property index to readjava.io.IOException
- if an I/O error occurspublic byte[] readByteArray(int iProp) throws java.io.IOException
readByteArray
in interface PofReader
iProp
- the property index to readjava.io.IOException
- if an I/O error occurspublic char[] readCharArray(int iProp) throws java.io.IOException
readCharArray
in interface PofReader
iProp
- the property index to readjava.io.IOException
- if an I/O error occurspublic short[] readShortArray(int iProp) throws java.io.IOException
readShortArray
in interface PofReader
iProp
- the property index to readjava.io.IOException
- if an I/O error occurspublic int[] readIntArray(int iProp) throws java.io.IOException
readIntArray
in interface PofReader
iProp
- the property index to readjava.io.IOException
- if an I/O error occurspublic long[] readLongArray(int iProp) throws java.io.IOException
readLongArray
in interface PofReader
iProp
- the property index to readjava.io.IOException
- if an I/O error occurspublic float[] readFloatArray(int iProp) throws java.io.IOException
readFloatArray
in interface PofReader
iProp
- the property index to readjava.io.IOException
- if an I/O error occurspublic double[] readDoubleArray(int iProp) throws java.io.IOException
readDoubleArray
in interface PofReader
iProp
- the property index to readjava.io.IOException
- if an I/O error occurspublic java.math.BigInteger readBigInteger(int iProp) throws java.io.IOException
readBigInteger
in interface PofReader
iProp
- the property index to readjava.io.IOException
- if an I/O error occurspublic RawQuad readRawQuad(int iProp) throws java.io.IOException
readRawQuad
in interface PofReader
iProp
- the property index to readjava.io.IOException
- if an I/O error occurspublic java.math.BigDecimal readBigDecimal(int iProp) throws java.io.IOException
readBigDecimal
in interface PofReader
iProp
- the property index to readjava.io.IOException
- if an I/O error occurspublic Binary readBinary(int iProp) throws java.io.IOException
readBinary
in interface PofReader
iProp
- the property index to readjava.io.IOException
- if an I/O error occurspublic java.lang.String readString(int iProp) throws java.io.IOException
readString
in interface PofReader
iProp
- the property index to readjava.io.IOException
- if an I/O error occurspublic java.util.Date readDate(int iProp) throws java.io.IOException
readDate
in interface PofReader
iProp
- the property index to readjava.io.IOException
- if an I/O error occurspublic RawDate readRawDate(int iProp) throws java.io.IOException
RawDate
class contains the raw date information that was carried in the POF stream.readRawDate
in interface PofReader
iProp
- the property index to readjava.io.IOException
- if an I/O error occurspublic RawTime readRawTime(int iProp) throws java.io.IOException
RawTime
class contains the raw time information that was carried in the POF stream, including raw timezone information.readRawTime
in interface PofReader
iProp
- the property index to readjava.io.IOException
- if an I/O error occurspublic RawDateTime readRawDateTime(int iProp) throws java.io.IOException
RawDateTime
class contains the raw date and time information that was carried in the POF stream, including raw timezone information.readRawDateTime
in interface PofReader
iProp
- the property index to readjava.io.IOException
- if an I/O error occurspublic RawYearMonthInterval readRawYearMonthInterval(int iProp) throws java.io.IOException
RawYearMonthInterval
class contains the raw year-month interval information that was carried in the POF stream.readRawYearMonthInterval
in interface PofReader
iProp
- the property index to readjava.io.IOException
- if an I/O error occurspublic RawTimeInterval readRawTimeInterval(int iProp) throws java.io.IOException
RawTimeInterval
class contains the raw time interval information that was carried in the POF stream.readRawTimeInterval
in interface PofReader
iProp
- the property index to readjava.io.IOException
- if an I/O error occurspublic RawDayTimeInterval readRawDayTimeInterval(int iProp) throws java.io.IOException
RawDayTimeInterval
class contains the raw year-month interval information that was carried in the POF stream.readRawDayTimeInterval
in interface PofReader
iProp
- the property index to readjava.io.IOException
- if an I/O error occurspublic java.lang.Object[] readObjectArray(int iProp, java.lang.Object[] ao) throws java.io.IOException
readObjectArray
in interface PofReader
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 for Collection.toArray()
java.io.IOException
- if an I/O error occurspublic LongArray readLongArray(int iProp, LongArray array) throws java.io.IOException
readLongArray
in interface PofReader
iProp
- the property index to readarray
- the optional LongArray object to use to store the valuesjava.io.IOException
- if an I/O error occurspublic java.util.Collection readCollection(int iProp, java.util.Collection coll) throws java.io.IOException
readCollection
in interface PofReader
iProp
- the property index to readcoll
- the optional Collection to use to store the valuesjava.io.IOException
- if an I/O error occurspublic java.util.Map readMap(int iProp, java.util.Map map) throws java.io.IOException
readMap
in interface PofReader
iProp
- the property index to readmap
- the optional Map to initializejava.io.IOException
- if an I/O error occurspublic PofContext getPofContext()
getPofContext
in interface PofReader
public void setPofContext(PofContext ctx)
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); }
setPofContext
in interface PofReader
ctx
- the new PofContext; must not be nullpublic java.lang.Object readObject(int iProp) throws java.io.IOException
readObject
in interface PofReader
iProp
- the property index to readjava.io.IOException
- if an I/O error occurspublic int getUserTypeId()
getUserTypeId
in interface PofReader
public int getVersionId()
getVersionId
in interface PofReader
public void registerIdentity(java.lang.Object o)
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.
registerIdentity
in interface PofReader
o
- the object to register the identity forPofSerializer.deserialize(PofReader)
public PofReader createNestedPofReader(int iProp) throws java.io.IOException
createNestedPofReader
in interface PofReader
iProp
- the property index to read fromjava.io.IOException
- if an I/O error occurspublic Binary readRemainder() throws java.io.IOException
Subsequent calls to the various readXYZ methods of this interface will fail after this method is called.
readRemainder
in interface PofReader
java.io.IOException
- if an I/O error occursprotected boolean advanceTo(int iProp) throws java.io.IOException
iProp
- the index of the property to advance tojava.lang.IllegalStateException
- if the POF stream has already advanced past the desired propertyjava.io.IOException
- if an I/O error occursprotected void complete(int iProp) throws java.io.IOException
iProp
- the property indexjava.io.IOException
- if an I/O error occursprotected PofBufferReader getParentParser()
protected LongArray ensureReferenceRegistry()
protected void registerIdentity(int nId, java.lang.Object oValue)
nId
- the identity within the POF stream of the objectoValue
- the object to associate with the passed identityjava.lang.IllegalArgumentException
- if the specified identity is already registered with a different objectprotected java.lang.Object lookupIdentity(int nId) throws java.io.IOException
nId
- the identityjava.io.IOException
- if the requested identity is not registeredprotected java.lang.Object readAsObject(int nType) throws java.io.IOException
nType
- the type identifier of the valuejava.io.IOException
- if an I/O error occursprotected java.lang.Object readAsUniformObject(int nType) throws java.io.IOException
nType
- the type identifier of the valuejava.io.IOException
- if an I/O error occursprotected java.lang.Object[] readAsObjectArray(int nType, java.lang.Object[] ao) throws java.io.IOException
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 for Collection.toArray()
java.io.IOException
- if an I/O error occursprotected static Binary readBinary(ReadBuffer.BufferInput in) throws java.io.IOException
in
- a BufferInput to read fromjava.io.IOException
- if an I/O error occurs
|
Oracle® Coherence Java API Reference Release 12.1.2.0.3 E26043-02 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |