Class PofStreamReader.UserTypeReader
The UserTypeReader implementation is a contextually-aware IPofReader whose purpose is to advance through the properties of a value of a specified user type.
Implements
Inherited Members
Namespace: Tangosol.IO.Pof
Assembly: Coherence.dll
Syntax
public class PofStreamReader.UserTypeReader : PofStreamReader, IPofReader
Remarks
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 IPofContext that may differ from the IPofContext that provided the IPofSerializer which is using this UserTypeReader to parse a user type.
Constructors
UserTypeReader(DataReader, IPofContext, int, int)
Construct a parser for parsing the property values of a user type.
Declaration
public UserTypeReader(DataReader reader, IPofContext ctx, int typeId, int versionId)
Parameters
Type | Name | Description |
---|---|---|
DataReader | reader | The DataReader that contains the user type data, except for the user type id itself (which is passed as a constructor argument). |
IPofContext | ctx | The IPofContext to use for parsing the user type property values within the user type that this parser will be parsing. |
int | typeId | The type id of the user type. |
int | versionId | The version id of the user type. |
Exceptions
Type | Condition |
---|---|
IOException | If an I/O error occurs. |
UserTypeReader(PofStreamReader, DataReader, IPofContext, int, int)
Construct a parser for parsing the property values of a user type.
Declaration
public UserTypeReader(PofStreamReader parent, DataReader reader, IPofContext ctx, int typeId, int versionId)
Parameters
Type | Name | Description |
---|---|---|
PofStreamReader | parent | The parent PofStreamReader (ie the containing) PofBufferReader |
DataReader | reader | The DataReader that contains the user type data, except for the user type id itself (which is passed as a constructor argument). |
IPofContext | ctx | The IPofContext to use for parsing the user type property values within the user type that this parser will be parsing. |
int | typeId | The type id of the user type. |
int | versionId | The version id of the user type. |
Exceptions
Type | Condition |
---|---|
IOException | If an I/O error occurs. |
Properties
NextPropertyIndex
Return the index of the next property in the POF stream.
Declaration
public int NextPropertyIndex { get; }
Property Value
Type | Description |
---|---|
int |
ParentParser
If this parser is contextually within a user type, obtain the parser which created this parser in order to parse the user type.
Declaration
protected override PofStreamReader ParentParser { get; }
Property Value
Type | Description |
---|---|
PofStreamReader | The parser for the context within which this parser is operating. |
Overrides
PreviousPropertyIndex
Return the index of the most recent property read or (if it were missing) requested.
Declaration
public int PreviousPropertyIndex { get; }
Property Value
Type | Description |
---|---|
int |
UserTypeId
Gets the user type that is currently being parsed.
Declaration
public override int UserTypeId { get; }
Property Value
Type | Description |
---|---|
int | The user type information, or -1 if the PofStreamReader is not currently parsing a user type. |
Overrides
VersionId
Gets the version identifier of the user type that is currently being parsed.
Declaration
public override int VersionId { get; }
Property Value
Type | Description |
---|---|
int | The integer version ID read from the POF stream; always non-negative. |
Overrides
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If no user type is being parsed. |
Methods
AdvanceTo(int)
Advance through the POF stream until the specified property is found.
Declaration
protected override bool AdvanceTo(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | The index of the property to advance to. |
Returns
Type | Description |
---|---|
bool | true if the property is found. |
Overrides
Remarks
If the property is found, return true, otherwise return false and advance to the first property that follows the specified property.
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the POF stream has already advanced past the desired property. |
IOException | If an I/O error occurs. |
CloseNested()
Notify the UserTypeReader that it is being "closed".
Declaration
protected void CloseNested()
Exceptions
Type | Condition |
---|---|
NotSupportedException | throws IOException if an I/O error occurs |
Complete(int)
Register the completion of the parsing of a value.
Declaration
protected override void Complete(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | The property index. |
Overrides
Exceptions
Type | Condition |
---|---|
IOException | If an I/O error occurs. |
CreateNestedPofReader(int)
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.
Declaration
public override IPofReader CreateNestedPofReader(int iProp)
Parameters
Type | Name | Description |
---|---|---|
int | iProp | the property index to read from |
Returns
Type | Description |
---|---|
IPofReader | a PofReader that reads its contents from a single property of this PofReader |
Overrides
Exceptions
Type | Condition |
---|---|
InvalidOperationException | 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 |
ReadRemainder()
Read all remaining indexed properties of the current user type from the POF stream.
Declaration
public override Binary ReadRemainder()
Returns
Type | Description |
---|---|
Binary | A Binary containing zero or more indexed properties in binary POF encoded form. |
Overrides
Remarks
As part of reading in a user type, this method must be called by the IPofSerializer 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.
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If no user type is being parsed. |
IOException | If an I/O error occurs. |
RegisterIdentity(object)
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. IPofSerializer implementations must call this method with each user type instance instantiated during deserialization prior to reading any properties of the instance which are user type instances themselves.Declaration
public override void RegisterIdentity(object o)
Parameters
Type | Name | Description |
---|---|---|
object | o | The object to register the identity for. |