CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation

com.tangosol.io.pof
Interface PofReader

All Known Implementing Classes:
PofBufferReader, PofBufferReader.UserTypeReader

public interface PofReader

The PofReader interface provides the capability of reading a set of non-primitive Java types ("user types") from a POF stream as an ordered sequence of indexed properties.

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:
PofContext, PofWriter

Method Summary
 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.
 BigDecimal readBigDecimal(int iProp)
          Read a BigDecimal from the POF stream.
 BigInteger readBigInteger(int iProp)
          Read a BigInteger from the POF stream.
 Binary 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.
 Collection readCollection(int iProp, Collection coll)
          Read a Collection of object values from the POF stream.
 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.
 Map readMap(int iProp, Map map)
          Read a Map of key/value pairs from the POF stream.
 Object readObject(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.
 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.
 String readString(int iProp)
          Read a String from the POF stream.
 void setPofContext(PofContext ctx)
          Configure the PofContext object used by this PofReader to deserialize user types from a POF stream.
 

Method Detail

readBoolean

boolean readBoolean(int iProp)
                    throws IOException
Read a boolean property from the POF stream.

Parameters:
iProp - the property index to read
Returns:
the boolean property value
Throws:
IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
IOException - if an I/O error occurs

readByte

byte readByte(int iProp)
              throws IOException
Read a byte property from the POF stream.

Parameters:
iProp - the property index to read
Returns:
the byte property value
Throws:
IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
IOException - if an I/O error occurs

readChar

char readChar(int iProp)
              throws IOException
Read a char property from the POF stream.

Parameters:
iProp - the property index to read
Returns:
the char property value
Throws:
IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
IOException - if an I/O error occurs

readShort

short readShort(int iProp)
                throws IOException
Read a short property from the POF stream.

Parameters:
iProp - the property index to read
Returns:
the short property value
Throws:
IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
IOException - if an I/O error occurs

readInt

int readInt(int iProp)
            throws IOException
Read a int property from the POF stream.

Parameters:
iProp - the property index to read
Returns:
the int property value
Throws:
IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
IOException - if an I/O error occurs

readLong

long readLong(int iProp)
              throws IOException
Read a long property from the POF stream.

Parameters:
iProp - the property index to read
Returns:
the long property value
Throws:
IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
IOException - if an I/O error occurs

readFloat

float readFloat(int iProp)
                throws IOException
Read a float property from the POF stream.

Parameters:
iProp - the property index to read
Returns:
the float property value
Throws:
IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
IOException - if an I/O error occurs

readDouble

double readDouble(int iProp)
                  throws IOException
Read a double property from the POF stream.

Parameters:
iProp - the property index to read
Returns:
the double property value
Throws:
IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
IOException - if an I/O error occurs

readBooleanArray

boolean[] readBooleanArray(int iProp)
                           throws IOException
Read a boolean[] property from the POF stream.

Parameters:
iProp - the property index to read
Returns:
the boolean[] property value; may be null
Throws:
IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
IOException - if an I/O error occurs

readByteArray

byte[] readByteArray(int iProp)
                     throws IOException
Read a byte[] property from the POF stream.

Parameters:
iProp - the property index to read
Returns:
the byte[] property value; may be null
Throws:
IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
IOException - if an I/O error occurs

readCharArray

char[] readCharArray(int iProp)
                     throws IOException
Read a char[] property from the POF stream.

Parameters:
iProp - the property index to read
Returns:
the char[] property value; may be null
Throws:
IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
IOException - if an I/O error occurs

readShortArray

short[] readShortArray(int iProp)
                       throws IOException
Read a short[] property from the POF stream.

Parameters:
iProp - the property index to read
Returns:
the short[] property value; may be null
Throws:
IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
IOException - if an I/O error occurs

readIntArray

int[] readIntArray(int iProp)
                   throws IOException
Read a int[] property from the POF stream.

Parameters:
iProp - the property index to read
Returns:
the int[] property value; may be null
Throws:
IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
IOException - if an I/O error occurs

readLongArray

long[] readLongArray(int iProp)
                     throws IOException
Read a long[] property from the POF stream.

Parameters:
iProp - the property index to read
Returns:
the long[] property value; may be null
Throws:
IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
IOException - if an I/O error occurs

readFloatArray

float[] readFloatArray(int iProp)
                       throws IOException
Read a float[] property from the POF stream.

Parameters:
iProp - the property index to read
Returns:
the float[] property value; may be null
Throws:
IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
IOException - if an I/O error occurs

readDoubleArray

double[] readDoubleArray(int iProp)
                         throws IOException
Read a double[] property from the POF stream.

Parameters:
iProp - the property index to read
Returns:
the double[] property value; may be null
Throws:
IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
IOException - if an I/O error occurs

readBigInteger

BigInteger readBigInteger(int iProp)
                          throws IOException
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:
IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
IOException - if an I/O error occurs

readRawQuad

RawQuad readRawQuad(int iProp)
                    throws IOException
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:
IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
IOException - if an I/O error occurs

readBigDecimal

BigDecimal readBigDecimal(int iProp)
                          throws IOException
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:
IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
IOException - if an I/O error occurs

readBinary

Binary readBinary(int iProp)
                  throws IOException
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:
IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
IOException - if an I/O error occurs

readString

String readString(int iProp)
                  throws IOException
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:
IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
IOException - if an I/O error occurs

readDate

Date readDate(int iProp)
              throws IOException
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:
IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
IOException - if an I/O error occurs

readRawDate

RawDate readRawDate(int iProp)
                    throws IOException
Read a RawDate from the POF stream. The RawDate 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:
IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
IOException - if an I/O error occurs

readRawTime

RawTime readRawTime(int iProp)
                    throws IOException
Read a RawTime from the POF stream. The RawTime 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:
IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
IOException - if an I/O error occurs

readRawDateTime

RawDateTime readRawDateTime(int iProp)
                            throws IOException
Read a RawDateTime from the POF stream. The RawDateTime 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:
IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
IOException - if an I/O error occurs

readRawYearMonthInterval

RawYearMonthInterval readRawYearMonthInterval(int iProp)
                                              throws IOException
Read a RawYearMonthInterval from the POF stream. The RawYearMonthInterval 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:
IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
IOException - if an I/O error occurs

readRawTimeInterval

RawTimeInterval readRawTimeInterval(int iProp)
                                    throws IOException
Read a RawTimeInterval from the POF stream. The RawTimeInterval 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:
IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
IOException - if an I/O error occurs

readRawDayTimeInterval

RawDayTimeInterval readRawDayTimeInterval(int iProp)
                                          throws IOException
Read a RawDayTimeInterval from the POF stream. The RawDayTimeInterval 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:
IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
IOException - if an I/O error occurs

readObject

Object readObject(int iProp)
                  throws IOException
Read a property of any type, including a user type, from the POF stream.

Parameters:
iProp - the property index to read
Returns:
the Object value; may be null
Throws:
IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
IOException - if an I/O error occurs

readObjectArray

Object[] readObjectArray(int iProp,
                         Object[] ao)
                         throws IOException
Read an array of object values.

Parameters:
iProp - the property index to read
ao - 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()
Returns:
an array of object values, or null if no array is passed and there is no array data in the POF stream
Throws:
IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
IOException - if an I/O error occurs

readLongArray

LongArray readLongArray(int iProp,
                        LongArray array)
                        throws IOException
Read a LongArray of object values.

Parameters:
iProp - the property index to read
array - 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:
IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
IOException - if an I/O error occurs

readCollection

Collection readCollection(int iProp,
                          Collection coll)
                          throws IOException
Read a Collection of object values from the POF stream.

Parameters:
iProp - the property index to read
coll - 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:
IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
IOException - if an I/O error occurs

readMap

Map readMap(int iProp,
            Map map)
            throws IOException
Read a Map of key/value pairs from the POF stream.

Parameters:
iProp - the property index to read
map - 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:
IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
IOException - 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

void setPofContext(PofContext ctx)
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

readRemainder

Binary readRemainder()
                     throws IOException
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 parsed
IOException - if an I/O error occurs

CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation