Oracle® Coherence Java API Reference
v3.5

E14977-01

com.tangosol.io.pof
Interface PofWriter

All Known Implementing Classes:
PofBufferWriter, PofBufferWriter.UserTypeWriter

public interface PofWriter

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

The serialized format of a POF user type is as follows:

The type identifier is an integer value greater than or equal to zero that identifies the non-primitive Java type. The type identifier has no explicit or self-describing meaning within the POF stream itself; in other words, the type identifier does not contain the actual class definition. Instead, the PofWriter and corresponding PofReader share a PofContext which contains the necessary meta-data, including type identifier to Java type mappings.

The version identifier is used to support both backwards and forwards compatibility of serialized POF user types. Versioning of user types allows the addition of new properties to a user type, but not the replacement or removal of properties that existed in a previous version of the user type.

When a version v1 of a user type written by a PofWriter is read by a PofReader that supports version v2 of the same user type, the PofReader returns default values for the additional properties of the User Type that exist in v2 but do not exist in v1. Conversely, when a version v2 of a user type written by a PofWriter is read by a PofReader that supports version v1 of the same user type, the instance of user type v1 must store those additional opaque properties for later encoding. The PofReader enables the user type to store off the opaque properties in binary form (see PofReader.readRemainder()). When the user type is re-encoded, it must be done so using the version identifier v2, since it is including the unaltered v2 properties. The opaque properties are subsequently included in the POF stream using the writeRemainder(com.tangosol.util.Binary) method.

Following the version identifier is an ordered sequence of index/value pairs, each of which is composed of a property index encoded as non-negative integer value whose value is greater than the previous property index, and a property value encoded as a POF value. The user type is finally terminated with an illegal property index of -1.

Since:
Coherence 3.2
Author:
cp/jh 2006.07.13
See Also:
PofContext, PofReader

Method Summary
 PofContext getPofContext()
          Return the PofContext object used by this PofWriter to serialize user types to a POF stream.
 int getUserTypeId()
          Determine the user type that is currently being written.
 int getVersionId()
          Determine the version identifier of the user type that is currently being written.
 void setPofContext(PofContext ctx)
          Configure the PofContext object used by this PofWriter to serialize user types to a POF stream.
 void setVersionId(int nVersionId)
          Set the version identifier of the user type that is currently being written.
 void writeBigDecimal(int iProp, java.math.BigDecimal dec)
          Write a BigDecimal property to the POF stream.
 void writeBigInteger(int iProp, java.math.BigInteger n)
          Write a BigInteger property to the POF stream.
 void writeBinary(int iProp, Binary bin)
          Write a Binary property to the POF stream.
 void writeBoolean(int iProp, boolean f)
          Write a boolean property to the POF stream.
 void writeBooleanArray(int iProp, boolean[] af)
          Write a boolean[] property to the POF stream.
 void writeByte(int iProp, byte b)
          Write a byte property to the POF stream.
 void writeByteArray(int iProp, byte[] ab)
          Write a byte[] property to the POF stream.
 void writeChar(int iProp, char ch)
          Write a char property to the POF stream.
 void writeCharArray(int iProp, char[] ach)
          Write a char[] property to the POF stream.
 void writeCollection(int iProp, java.util.Collection coll)
          Write a Collection property to the POF stream.
 void writeCollection(int iProp, java.util.Collection coll, java.lang.Class clz)
          Write a uniform Collection property to the POF stream.
 void writeDate(int iProp, java.util.Date dt)
          Write a Date property to the POF stream in ISO8601 format.
 void writeDateTime(int iProp, java.util.Date dt)
          Write a Date property to the POF stream in ISO8601 format.
 void writeDateTime(int iProp, java.sql.Timestamp dt)
          Write a Timestamp property to the POF stream in ISO8601 format.
 void writeDateTimeWithZone(int iProp, java.util.Date dt)
          Write a Date property to the POF stream in ISO8601 format.
 void writeDateTimeWithZone(int iProp, java.sql.Timestamp dt)
          Write a Timestamp property to the POF stream in ISO8601 format.
 void writeDouble(int iProp, double dfl)
          Write a double property to the POF stream.
 void writeDoubleArray(int iProp, double[] adfl)
          Write a double[] property to the POF stream.
 void writeFloat(int iProp, float fl)
          Write a float property to the POF stream.
 void writeFloatArray(int iProp, float[] afl)
          Write a float[] property to the POF stream.
 void writeInt(int iProp, int n)
          Write a int property to the POF stream.
 void writeIntArray(int iProp, int[] an)
          Write a int[] property to the POF stream.
 void writeLong(int iProp, long n)
          Write a long property to the POF stream.
 void writeLongArray(int iProp, long[] an)
          Write a long[] property to the POF stream.
 void writeLongArray(int iProp, LongArray la)
          Write a LongArray property to the POF stream.
 void writeLongArray(int iProp, LongArray la, java.lang.Class clz)
          Write a uniform LongArray property to the POF stream.
 void writeMap(int iProp, java.util.Map map)
          Write a Map property to the POF stream.
 void writeMap(int iProp, java.util.Map map, java.lang.Class clzKey)
          Write a uniform key Map property to the POF stream.
 void writeMap(int iProp, java.util.Map map, java.lang.Class clzKey, java.lang.Class clzValue)
          Write a uniform Map property to the POF stream.
 void writeObject(int iProp, java.lang.Object o)
          Write an Object property to the POF stream.
 void writeObjectArray(int iProp, java.lang.Object[] ao)
          Write an Object[] property to the POF stream.
 void writeObjectArray(int iProp, java.lang.Object[] ao, java.lang.Class clz)
          Write a uniform Object[] property to the POF stream.
 void writeRawDate(int iProp, RawDate date)
          Write a RawDate property to the POF stream.
 void writeRawDateTime(int iProp, RawDateTime dt)
          Write a RawDateTime property to the POF stream.
 void writeRawDayTimeInterval(int iProp, RawDayTimeInterval interval)
          Write a RawDayTimeInterval property to the POF stream.
 void writeRawQuad(int iProp, RawQuad qfl)
          Write a RawQuad property to the POF stream.
 void writeRawTime(int iProp, RawTime time)
          Write a RawTime property to the POF stream.
 void writeRawTimeInterval(int iProp, RawTimeInterval interval)
          Write a RawTimeInterval property to the POF stream.
 void writeRawYearMonthInterval(int iProp, RawYearMonthInterval interval)
          Write a RawYearMonthInterval property to the POF stream.
 void writeRemainder(Binary binProps)
          Write the remaining properties to the POF stream, terminating the writing of the currrent user type.
 void writeShort(int iProp, short n)
          Write a short property to the POF stream.
 void writeShortArray(int iProp, short[] an)
          Write a short[] property to the POF stream.
 void writeString(int iProp, java.lang.String s)
          Write a String property to the POF stream.
 void writeTime(int iProp, java.util.Date dt)
          Write a Date property to the POF stream in ISO8601 format.
 void writeTime(int iProp, java.sql.Timestamp dt)
          Write a Timestamp property to the POF stream in ISO8601 format.
 void writeTimeWithZone(int iProp, java.util.Date dt)
          Write a Date property to the POF stream in ISO8601 format.
 void writeTimeWithZone(int iProp, java.sql.Timestamp dt)
          Write a Timestamp property to the POF stream in ISO8601 format.
 

Method Detail

writeBoolean

void writeBoolean(int iProp,
                  boolean f)
                  throws java.io.IOException
Write a boolean property to the POF stream.

Parameters:
iProp - the property index
f - the boolean property value to write
Throws:
java.lang.IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream
java.io.IOException - if an I/O error occurs

writeByte

void writeByte(int iProp,
               byte b)
               throws java.io.IOException
Write a byte property to the POF stream.

Parameters:
iProp - the property index
b - the byte property value to write
Throws:
java.lang.IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream
java.io.IOException - if an I/O error occurs

writeChar

void writeChar(int iProp,
               char ch)
               throws java.io.IOException
Write a char property to the POF stream.

Parameters:
iProp - the property index
ch - the char property value to write
Throws:
java.lang.IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream
java.io.IOException - if an I/O error occurs

writeShort

void writeShort(int iProp,
                short n)
                throws java.io.IOException
Write a short property to the POF stream.

Parameters:
iProp - the property index
n - the short property value to write
Throws:
java.lang.IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream
java.io.IOException - if an I/O error occurs

writeInt

void writeInt(int iProp,
              int n)
              throws java.io.IOException
Write a int property to the POF stream.

Parameters:
iProp - the property index
n - the int property value to write
Throws:
java.lang.IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream
java.io.IOException - if an I/O error occurs

writeLong

void writeLong(int iProp,
               long n)
               throws java.io.IOException
Write a long property to the POF stream.

Parameters:
iProp - the property index
n - the long property value to write
Throws:
java.lang.IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream
java.io.IOException - if an I/O error occurs

writeFloat

void writeFloat(int iProp,
                float fl)
                throws java.io.IOException
Write a float property to the POF stream.

Parameters:
iProp - the property index
fl - the float property value to write
Throws:
java.lang.IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream
java.io.IOException - if an I/O error occurs

writeDouble

void writeDouble(int iProp,
                 double dfl)
                 throws java.io.IOException
Write a double property to the POF stream.

Parameters:
iProp - the property index
dfl - the double property value to write
Throws:
java.lang.IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream
java.io.IOException - if an I/O error occurs

writeBooleanArray

void writeBooleanArray(int iProp,
                       boolean[] af)
                       throws java.io.IOException
Write a boolean[] property to the POF stream.

Parameters:
iProp - the property index
af - the boolean[] property value to write
Throws:
java.lang.IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream
java.io.IOException - if an I/O error occurs

writeByteArray

void writeByteArray(int iProp,
                    byte[] ab)
                    throws java.io.IOException
Write a byte[] property to the POF stream.

Parameters:
iProp - the property index
ab - the byte[] property value to write
Throws:
java.lang.IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream
java.io.IOException - if an I/O error occurs

writeCharArray

void writeCharArray(int iProp,
                    char[] ach)
                    throws java.io.IOException
Write a char[] property to the POF stream.

Parameters:
iProp - the property index
ach - the char[] property value to write
Throws:
java.lang.IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream
java.io.IOException - if an I/O error occurs

writeShortArray

void writeShortArray(int iProp,
                     short[] an)
                     throws java.io.IOException
Write a short[] property to the POF stream.

Parameters:
iProp - the property index
an - the short[] property value to write
Throws:
java.lang.IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream
java.io.IOException - if an I/O error occurs

writeIntArray

void writeIntArray(int iProp,
                   int[] an)
                   throws java.io.IOException
Write a int[] property to the POF stream.

Parameters:
iProp - the property index
an - the int[] property value to write
Throws:
java.lang.IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream
java.io.IOException - if an I/O error occurs

writeLongArray

void writeLongArray(int iProp,
                    long[] an)
                    throws java.io.IOException
Write a long[] property to the POF stream.

Parameters:
iProp - the property index
an - the long[] property value to write
Throws:
java.lang.IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream
java.io.IOException - if an I/O error occurs

writeFloatArray

void writeFloatArray(int iProp,
                     float[] afl)
                     throws java.io.IOException
Write a float[] property to the POF stream.

Parameters:
iProp - the property index
afl - the float[] property value to write
Throws:
java.lang.IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream
java.io.IOException - if an I/O error occurs

writeDoubleArray

void writeDoubleArray(int iProp,
                      double[] adfl)
                      throws java.io.IOException
Write a double[] property to the POF stream.

Parameters:
iProp - the property index
adfl - the double[] property value to write
Throws:
java.lang.IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream
java.io.IOException - if an I/O error occurs

writeBigInteger

void writeBigInteger(int iProp,
                     java.math.BigInteger n)
                     throws java.io.IOException
Write a BigInteger property to the POF stream.

Parameters:
iProp - the property index
n - the BigInteger property value to write
Throws:
java.lang.IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream
java.io.IOException - if an I/O error occurs

writeRawQuad

void writeRawQuad(int iProp,
                  RawQuad qfl)
                  throws java.io.IOException
Write a RawQuad property to the POF stream.

Parameters:
iProp - the property index
qfl - the RawQuad property value to write
Throws:
java.lang.IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream
java.io.IOException - if an I/O error occurs

writeBigDecimal

void writeBigDecimal(int iProp,
                     java.math.BigDecimal dec)
                     throws java.io.IOException
Write a BigDecimal property to the POF stream.

Parameters:
iProp - the property index
dec - the BigDecimal property value to write
Throws:
java.lang.IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream
java.io.IOException - if an I/O error occurs

writeBinary

void writeBinary(int iProp,
                 Binary bin)
                 throws java.io.IOException
Write a Binary property to the POF stream.

Parameters:
iProp - the property index
bin - the Binary property value to write
Throws:
java.lang.IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream
java.io.IOException - if an I/O error occurs

writeString

void writeString(int iProp,
                 java.lang.String s)
                 throws java.io.IOException
Write a String property to the POF stream.

Parameters:
iProp - the property index
s - the String property value to write
Throws:
java.lang.IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream
java.io.IOException - if an I/O error occurs

writeDate

void writeDate(int iProp,
               java.util.Date dt)
               throws java.io.IOException
Write a Date property to the POF stream in ISO8601 format.

This method encodes the year, month and day information of the specified Date object. No time or timezone information is encoded.

Parameters:
iProp - the property index
dt - the Date property value to write in ISO8601 format
Throws:
java.lang.IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream
java.io.IOException - if an I/O error occurs

writeDateTime

void writeDateTime(int iProp,
                   java.util.Date dt)
                   throws java.io.IOException
Write a Date property to the POF stream in ISO8601 format.

This method encodes the year, month, day, hour, minute, second and millisecond information of the specified Date object. No timezone information is encoded.

Parameters:
iProp - the property index
dt - the Date property value to write in ISO8601 format
Throws:
java.lang.IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream
java.io.IOException - if an I/O error occurs

writeDateTime

void writeDateTime(int iProp,
                   java.sql.Timestamp dt)
                   throws java.io.IOException
Write a Timestamp property to the POF stream in ISO8601 format.

This method encodes the year, month, day, hour, minute, second, millisecond and nanosecond information of the specified Timestamp object. No timezone information is encoded.

Parameters:
iProp - the property index
dt - the Timestamp property value to write in ISO8601 format
Throws:
java.lang.IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream
java.io.IOException - if an I/O error occurs

writeDateTimeWithZone

void writeDateTimeWithZone(int iProp,
                           java.util.Date dt)
                           throws java.io.IOException
Write a Date property to the POF stream in ISO8601 format.

This method encodes the year, month, day, hour, minute, second, millisecond and timezone information of the specified Date object.

Parameters:
iProp - the property index
dt - the Date property value to write in ISO8601 format
Throws:
java.lang.IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream
java.io.IOException - if an I/O error occurs

writeDateTimeWithZone

void writeDateTimeWithZone(int iProp,
                           java.sql.Timestamp dt)
                           throws java.io.IOException
Write a Timestamp property to the POF stream in ISO8601 format.

This method encodes the year, month, day, hour, minute, second, millisecond, nanosecond and timezone information of the specified Timestamp object.

Parameters:
iProp - the property index
dt - the Timestamp property value to write in ISO8601 format
Throws:
java.lang.IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream
java.io.IOException - if an I/O error occurs

writeTime

void writeTime(int iProp,
               java.util.Date dt)
               throws java.io.IOException
Write a Date property to the POF stream in ISO8601 format.

This method encodes the hour, minute, second and millisecond information of the specified Date object. No year, month, day or timezone information is encoded.

Parameters:
iProp - the property index
dt - the Date property value to write in ISO8601 format
Throws:
java.lang.IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream
java.io.IOException - if an I/O error occurs

writeTime

void writeTime(int iProp,
               java.sql.Timestamp dt)
               throws java.io.IOException
Write a Timestamp property to the POF stream in ISO8601 format.

This method encodes the hour, minute, second, millisecond and nanosecond information of the specified Timestamp object.

Parameters:
iProp - the property index
dt - the Timestamp property value to write in ISO8601 format
Throws:
java.lang.IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream
java.io.IOException - if an I/O error occurs

writeTimeWithZone

void writeTimeWithZone(int iProp,
                       java.util.Date dt)
                       throws java.io.IOException
Write a Date property to the POF stream in ISO8601 format.

This method encodes the hour, minute, second, millisecond and timezone information of the specified Date object. No year, month or day information is encoded.

Parameters:
iProp - the property index
dt - the Date property value to write in ISO8601 format
Throws:
java.lang.IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream
java.io.IOException - if an I/O error occurs

writeTimeWithZone

void writeTimeWithZone(int iProp,
                       java.sql.Timestamp dt)
                       throws java.io.IOException
Write a Timestamp property to the POF stream in ISO8601 format.

This method encodes the hour, minute, second, millisecond, nanosecond and timezone information of the specified Timestamp object. No year, month or day information is encoded.

Parameters:
iProp - the property index
dt - the Timestamp property value to write in ISO8601 format
Throws:
java.lang.IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream
java.io.IOException - if an I/O error occurs

writeRawDate

void writeRawDate(int iProp,
                  RawDate date)
                  throws java.io.IOException
Write a RawDate property to the POF stream.

Parameters:
iProp - the property index
date - the RawDate property value to write
Throws:
java.lang.IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream
java.io.IOException - if an I/O error occurs

writeRawTime

void writeRawTime(int iProp,
                  RawTime time)
                  throws java.io.IOException
Write a RawTime property to the POF stream.

Parameters:
iProp - the property index
time - the RawTime property value to write
Throws:
java.lang.IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream
java.io.IOException - if an I/O error occurs

writeRawDateTime

void writeRawDateTime(int iProp,
                      RawDateTime dt)
                      throws java.io.IOException
Write a RawDateTime property to the POF stream.

Parameters:
iProp - the property index
dt - the RawDateTime property value to write
Throws:
java.lang.IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream
java.io.IOException - if an I/O error occurs

writeRawYearMonthInterval

void writeRawYearMonthInterval(int iProp,
                               RawYearMonthInterval interval)
                               throws java.io.IOException
Write a RawYearMonthInterval property to the POF stream.

Parameters:
iProp - the property index
interval - the RawYearMonthInterval property value to write
Throws:
java.lang.IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream
java.io.IOException - if an I/O error occurs

writeRawTimeInterval

void writeRawTimeInterval(int iProp,
                          RawTimeInterval interval)
                          throws java.io.IOException
Write a RawTimeInterval property to the POF stream.

Parameters:
iProp - the property index
interval - the RawTimeInterval property value to write
Throws:
java.lang.IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream
java.io.IOException - if an I/O error occurs

writeRawDayTimeInterval

void writeRawDayTimeInterval(int iProp,
                             RawDayTimeInterval interval)
                             throws java.io.IOException
Write a RawDayTimeInterval property to the POF stream.

Parameters:
iProp - the property index
interval - the RawDayTimeInterval property value to write
Throws:
java.lang.IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream
java.io.IOException - if an I/O error occurs

writeObject

void writeObject(int iProp,
                 java.lang.Object o)
                 throws java.io.IOException
Write an Object property to the POF stream.

The given object must be an instance of one of the following:

Otherwise, a PofSerializer for the object must be obtainable from the PofContext associated with this PofWriter.

Parameters:
iProp - the property index
o - the Object property to write
Throws:
java.lang.IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream
java.lang.IllegalArgumentException - if the given property cannot be encoded into a POF stream
java.io.IOException - if an I/O error occurs

writeObjectArray

void writeObjectArray(int iProp,
                      java.lang.Object[] ao)
                      throws java.io.IOException
Write an Object[] property to the POF stream.

Each element of the given array must be an instance (or an array of instances) of one of the following:

Otherwise, a PofSerializer for each element of the array must be obtainable from the PofContext associated with this PofWriter.

Parameters:
iProp - the property index
ao - the Object[] property to write
Throws:
java.lang.IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream
java.lang.IllegalArgumentException - if the given property cannot be encoded into a POF stream
java.io.IOException - if an I/O error occurs

writeObjectArray

void writeObjectArray(int iProp,
                      java.lang.Object[] ao,
                      java.lang.Class clz)
                      throws java.io.IOException
Write a uniform Object[] property to the POF stream.

Each element of the given array must be an instance (or an array of instances) of one of the following:

Otherwise, a PofSerializer for each element of the array must be obtainable from the PofContext associated with this PofWriter.

Additionally, the type of each element must be equal to the specified class.

Parameters:
iProp - the property index
ao - the Object[] property to write
clz - the class of all elements; must not be null
Throws:
java.lang.IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream
java.lang.IllegalArgumentException - if the given property cannot be encoded into a POF stream
java.lang.IllegalArgumentException - if the type of one or more elements of the array is not equal to the specified class
java.io.IOException - if an I/O error occurs

writeCollection

void writeCollection(int iProp,
                     java.util.Collection coll)
                     throws java.io.IOException
Write a Collection property to the POF stream.

Each element of the given Collection must be an instance (or an array of instances) of one of the following:

Otherwise, a PofSerializer for each element of the Collection must be obtainable from the PofContext associated with this PofWriter.

Parameters:
iProp - the property index
coll - the Collection property to write
Throws:
java.lang.IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream
java.lang.IllegalArgumentException - if the given property cannot be encoded into a POF stream
java.io.IOException - if an I/O error occurs

writeCollection

void writeCollection(int iProp,
                     java.util.Collection coll,
                     java.lang.Class clz)
                     throws java.io.IOException
Write a uniform Collection property to the POF stream.

Each element of the given Collection must be an instance (or an array of instances) of one of the following:

Otherwise, a PofSerializer for each element of the Collection must be obtainable from the PofContext associated with this PofWriter.

Additionally, the type of each element must be equal to the specified class.

Parameters:
iProp - the property index
coll - the Collection property to write
clz - the class of all elements; must not be null
Throws:
java.lang.IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream
java.lang.IllegalArgumentException - if the given property cannot be encoded into a POF stream
java.lang.IllegalArgumentException - if the type of one or more elements of the Collection is not equal to the specified class
java.io.IOException - if an I/O error occurs

writeLongArray

void writeLongArray(int iProp,
                    LongArray la)
                    throws java.io.IOException
Write a LongArray property to the POF stream.

Each element of the given LongArray must be an instance (or an array of instances) of one of the following:

Otherwise, a PofSerializer for each element of the LongArray must be obtainable from the PofContext associated with this PofWriter.

Parameters:
iProp - the property index
la - the LongArray property to write
Throws:
java.lang.IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream
java.lang.IllegalArgumentException - if the given property cannot be encoded into a POF stream
java.io.IOException - if an I/O error occurs

writeLongArray

void writeLongArray(int iProp,
                    LongArray la,
                    java.lang.Class clz)
                    throws java.io.IOException
Write a uniform LongArray property to the POF stream.

Each element of the given LongArray must be an instance (or an array of instances) of one of the following:

Otherwise, a PofSerializer for each element of the LongArray must be obtainable from the PofContext associated with this PofWriter.

Additionally, the type of each element must be equal to the specified class.

Parameters:
iProp - the property index
la - the LongArray property to write
clz - the class of all elements; must not be null
Throws:
java.lang.IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream
java.lang.IllegalArgumentException - if the given property cannot be encoded into a POF stream
java.lang.IllegalArgumentException - if the type of one or more elements of the LongArray is not equal to the specified class
java.io.IOException - if an I/O error occurs

writeMap

void writeMap(int iProp,
              java.util.Map map)
              throws java.io.IOException
Write a Map property to the POF stream.

Each key and value of the given Map must be an instance (or an array of instances) of one of the following:

Otherwise, a PofSerializer for each key and value of the Map must be obtainable from the PofContext associated with this PofWriter.

Parameters:
iProp - the property index
map - the Map property to write
Throws:
java.lang.IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream
java.lang.IllegalArgumentException - if the given property cannot be encoded into a POF stream
java.io.IOException - if an I/O error occurs

writeMap

void writeMap(int iProp,
              java.util.Map map,
              java.lang.Class clzKey)
              throws java.io.IOException
Write a uniform key Map property to the POF stream.

Each key and value of the given Map must be an instance (or an array of instances) of one of the following:

Otherwise, a PofSerializer for each key and value of the Map must be obtainable from the PofContext associated with this PofWriter.

Additionally, the type of each key must be equal to the specified class.

Parameters:
iProp - the property index
map - the Map property to write
clzKey - the class of all keys; must not be null
Throws:
java.lang.IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream
java.lang.IllegalArgumentException - if the given property cannot be encoded into a POF stream
java.lang.IllegalArgumentException - if the type of one or more keys is not equal to the specified class
java.io.IOException - if an I/O error occurs

writeMap

void writeMap(int iProp,
              java.util.Map map,
              java.lang.Class clzKey,
              java.lang.Class clzValue)
              throws java.io.IOException
Write a uniform Map property to the POF stream.

Each key and value of the given Map must be an instance (or an array of instances) of one of the following:

Otherwise, a PofSerializer for each key and value of the Map must be obtainable from the PofContext associated with this PofWriter.

Additionally, the type of each key and value must be equal to the specified key class and value class respectively.

Parameters:
iProp - the property index
map - the Map property to write
clzKey - the class of all keys; must not be null
clzValue - the class of all values; must not be null
Throws:
java.lang.IllegalArgumentException - if the property index is invalid, or is less than or equal to the index of the previous property written to the POF stream
java.lang.IllegalArgumentException - if the given property cannot be encoded into a POF stream
java.lang.IllegalArgumentException - if the type of one or more keys or values of the Map is not equal to the specified key or value class
java.io.IOException - if an I/O error occurs

getPofContext

PofContext getPofContext()
Return the PofContext object used by this PofWriter to serialize user types to 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 PofWriter to serialize user types to 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 = writer.getPofContext();
 try
     {
     // switch to another PofContext
     PofContext ctxNew = ...;
     writer.setContext(ctxNew);

     // output POF data using the writer
     }
 finally
     {
     // restore the original PofContext
     writer.setPofContext(ctxOrig);
     }
 

Parameters:
ctx - the new PofContext; must not be null

getUserTypeId

int getUserTypeId()
Determine the user type that is currently being written.

Returns:
the user type identifier, or -1 if the PofWriter is not currently writing a user type

getVersionId

int getVersionId()
Determine the version identifier of the user type that is currently being written.

Returns:
the integer version ID of the user type; always non-negative
Throws:
java.lang.IllegalStateException - if no user type is being written

setVersionId

void setVersionId(int nVersionId)
Set the version identifier of the user type that is currently being written.

Parameters:
nVersionId - the user type identifier; must be non-negative
Throws:
java.lang.IllegalArgumentException - if the given version ID is negative
java.lang.IllegalStateException - if no user type is being written

writeRemainder

void writeRemainder(Binary binProps)
                    throws java.io.IOException
Write the remaining properties to the POF stream, terminating the writing of the currrent user type. As part of writing out a user type, this method must be called by the PofSerializer that is writing out the user type, or the POF stream will be corrupted.

Calling this method terminates the current user type by writing a -1 to the POF stream after the last indexed property. Subsequent calls to the various writeXYZ methods of this interface will fail after this method is called.

Parameters:
binProps - a Binary object containing zero or more indexed properties in binary POF encoded form; may be null
Throws:
java.lang.IllegalStateException - if no user type is being written
java.io.IOException - if an I/O error occurs

Oracle® Coherence Java API Reference
v3.5

E14977-01

Copyright © 2000, 2009, Oracle. All rights reserved.