Interface PofWriter
- All Known Implementing Classes:
PofBufferWriter
,PofBufferWriter.UserTypeWriter
The serialized format of a POF user type is as follows:
- Type Identifier
- Version Identifier
- [Property Index, Property Value]*
- -1
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.
Note: To read a property that was written using a PofWriter method,
the corresponding read method on PofReader
must be used.
For example, if a property was written using writeByteArray(int, byte[])
,
PofReader.readByteArray(int)
must be used to read the property.
- Since:
- Coherence 3.2
- Author:
- cp/jh 2006.07.13
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptioncreateNestedPofWriter
(int iProp) Obtain a PofWriter that can be used to write a set of properties into a single property of the current user type.createNestedPofWriter
(int iProp, int nTypeId) Obtain a PofWriter that can be used to write a set of properties into a single property of the current user type.Return the PofContext object used by this PofWriter to serialize user types to a POF stream.int
Determine the user type that is currently being written.int
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, BigDecimal dec) Write a BigDecimal property to the POF stream.void
writeBigInteger
(int iProp, BigInteger n) Write a BigInteger property to the POF stream.void
writeBinary
(int iProp, Binary bin) Write aBinary
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.<T> void
writeCollection
(int iProp, Collection<? extends T> coll) Write a Collection property to the POF stream.<T> void
writeCollection
(int iProp, Collection<? extends T> coll, Class<? extends T> clz) Write a uniform Collection property to the POF stream.void
Write a LocalDate property to the POF stream in ISO8601 format.void
Write a Date property to the POF stream in ISO8601 format.void
writeDateTime
(int iProp, Timestamp dt) Write a Timestamp property to the POF stream in ISO8601 format.void
writeDateTime
(int iProp, LocalDateTime dt) Write a LocalDateTime property to the POF stream in ISO8601 format.void
writeDateTime
(int iProp, Date dt) Write a Date property to the POF stream in ISO8601 format.void
writeDateTimeWithZone
(int iProp, Timestamp dt) Write a Timestamp property to the POF stream in ISO8601 format.void
writeDateTimeWithZone
(int iProp, OffsetDateTime dt) Write a OffsetDateTime property to the POF stream in ISO8601 format.default void
writeDateTimeWithZone
(int iProp, ZonedDateTime dt) Write a ZonedDateTime property to the POF stream in ISO8601 format.void
writeDateTimeWithZone
(int iProp, Date dt) Write a Date 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.<T> void
writeLongArray
(int iProp, LongArray<? extends T> la) Write a LongArray property to the POF stream.<T> void
writeLongArray
(int iProp, LongArray<T> la, Class<T> clz) Write a uniform LongArray property to the POF stream.<K,
V> void Write a Map property to the POF stream.<K,
V> void Write a uniform key Map property to the POF stream.<K,
V> void Write a uniform Map property to the POF stream.void
writeObject
(int iProp, Object o) Write an Object property to the POF stream.<T> void
writeObjectArray
(int iProp, T[] ao) Write an Object[] property to the POF stream.<T> void
writeObjectArray
(int iProp, T[] ao, Class<? extends T> 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 current 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, String s) Write a String property to the POF stream.void
Write a Timestamp property to the POF stream in ISO8601 format.void
Write a LocalTime property to the POF stream in ISO8601 format.void
Write a Date property to the POF stream in ISO8601 format.void
writeTimeWithZone
(int iProp, Timestamp dt) Write a Timestamp property to the POF stream in ISO8601 format.void
writeTimeWithZone
(int iProp, OffsetTime dt) Write a OffsetTime property to the POF stream in ISO8601 format.void
writeTimeWithZone
(int iProp, Date dt) Write a Date property to the POF stream in ISO8601 format.
-
Method Details
-
writeBoolean
Write a boolean property to the POF stream.- Parameters:
iProp
- the property indexf
- the boolean property value to write- Throws:
IllegalArgumentException
- if the property index is invalid, or is less than or equal to the index of the previous property written to the POF streamIOException
- if an I/O error occurs
-
writeByte
Write a byte property to the POF stream.- Parameters:
iProp
- the property indexb
- the byte property value to write- Throws:
IllegalArgumentException
- if the property index is invalid, or is less than or equal to the index of the previous property written to the POF streamIOException
- if an I/O error occurs
-
writeChar
Write a char property to the POF stream.- Parameters:
iProp
- the property indexch
- the char property value to write- Throws:
IllegalArgumentException
- if the property index is invalid, or is less than or equal to the index of the previous property written to the POF streamIOException
- if an I/O error occurs
-
writeShort
Write a short property to the POF stream.- Parameters:
iProp
- the property indexn
- the short property value to write- Throws:
IllegalArgumentException
- if the property index is invalid, or is less than or equal to the index of the previous property written to the POF streamIOException
- if an I/O error occurs
-
writeInt
Write a int property to the POF stream.- Parameters:
iProp
- the property indexn
- the int property value to write- Throws:
IllegalArgumentException
- if the property index is invalid, or is less than or equal to the index of the previous property written to the POF streamIOException
- if an I/O error occurs
-
writeLong
Write a long property to the POF stream.- Parameters:
iProp
- the property indexn
- the long property value to write- Throws:
IllegalArgumentException
- if the property index is invalid, or is less than or equal to the index of the previous property written to the POF streamIOException
- if an I/O error occurs
-
writeFloat
Write a float property to the POF stream.- Parameters:
iProp
- the property indexfl
- the float property value to write- Throws:
IllegalArgumentException
- if the property index is invalid, or is less than or equal to the index of the previous property written to the POF streamIOException
- if an I/O error occurs
-
writeDouble
Write a double property to the POF stream.- Parameters:
iProp
- the property indexdfl
- the double property value to write- Throws:
IllegalArgumentException
- if the property index is invalid, or is less than or equal to the index of the previous property written to the POF streamIOException
- if an I/O error occurs
-
writeBooleanArray
Write a boolean[] property to the POF stream.- Parameters:
iProp
- the property indexaf
- the boolean[] property value to write- Throws:
IllegalArgumentException
- if the property index is invalid, or is less than or equal to the index of the previous property written to the POF streamIOException
- if an I/O error occurs
-
writeByteArray
Write a byte[] property to the POF stream.- Parameters:
iProp
- the property indexab
- the byte[] property value to write- Throws:
IllegalArgumentException
- if the property index is invalid, or is less than or equal to the index of the previous property written to the POF streamIOException
- if an I/O error occurs
-
writeCharArray
Write a char[] property to the POF stream.- Parameters:
iProp
- the property indexach
- the char[] property value to write- Throws:
IllegalArgumentException
- if the property index is invalid, or is less than or equal to the index of the previous property written to the POF streamIOException
- if an I/O error occurs
-
writeShortArray
Write a short[] property to the POF stream.- Parameters:
iProp
- the property indexan
- the short[] property value to write- Throws:
IllegalArgumentException
- if the property index is invalid, or is less than or equal to the index of the previous property written to the POF streamIOException
- if an I/O error occurs
-
writeIntArray
Write a int[] property to the POF stream.- Parameters:
iProp
- the property indexan
- the int[] property value to write- Throws:
IllegalArgumentException
- if the property index is invalid, or is less than or equal to the index of the previous property written to the POF streamIOException
- if an I/O error occurs
-
writeLongArray
Write a long[] property to the POF stream.- Parameters:
iProp
- the property indexan
- the long[] property value to write- Throws:
IllegalArgumentException
- if the property index is invalid, or is less than or equal to the index of the previous property written to the POF streamIOException
- if an I/O error occurs
-
writeFloatArray
Write a float[] property to the POF stream.- Parameters:
iProp
- the property indexafl
- the float[] property value to write- Throws:
IllegalArgumentException
- if the property index is invalid, or is less than or equal to the index of the previous property written to the POF streamIOException
- if an I/O error occurs
-
writeDoubleArray
Write a double[] property to the POF stream.- Parameters:
iProp
- the property indexadfl
- the double[] property value to write- Throws:
IllegalArgumentException
- if the property index is invalid, or is less than or equal to the index of the previous property written to the POF streamIOException
- if an I/O error occurs
-
writeBigInteger
Write a BigInteger property to the POF stream.- Parameters:
iProp
- the property indexn
- the BigInteger property value to write- Throws:
IllegalArgumentException
- if the property index is invalid, or is less than or equal to the index of the previous property written to the POF streamIllegalStateException
- if the given BigInteger does not fit into 128 bitsIOException
- if an I/O error occurs
-
writeRawQuad
Write a RawQuad property to the POF stream.- Parameters:
iProp
- the property indexqfl
- the RawQuad property value to write- Throws:
IllegalArgumentException
- if the property index is invalid, or is less than or equal to the index of the previous property written to the POF streamIOException
- if an I/O error occurs
-
writeBigDecimal
Write a BigDecimal property to the POF stream.- Parameters:
iProp
- the property indexdec
- the BigDecimal property value to write- Throws:
IllegalArgumentException
- if the property index is invalid, or is less than or equal to the index of the previous property written to the POF streamIllegalStateException
- if the signed unscaled form of the given BigDecimal does not fit into 128 bitsIOException
- if an I/O error occurs
-
writeBinary
Write aBinary
property to the POF stream.- Parameters:
iProp
- the property indexbin
- the Binary property value to write- Throws:
IllegalArgumentException
- if the property index is invalid, or is less than or equal to the index of the previous property written to the POF streamIOException
- if an I/O error occurs
-
writeString
Write a String property to the POF stream.- Parameters:
iProp
- the property indexs
- the String property value to write- Throws:
IllegalArgumentException
- if the property index is invalid, or is less than or equal to the index of the previous property written to the POF streamIOException
- if an I/O error occurs
-
writeDate
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 indexdt
- the Date property value to write in ISO8601 format- Throws:
IllegalArgumentException
- if the property index is invalid, or is less than or equal to the index of the previous property written to the POF streamIOException
- if an I/O error occurs
-
writeDate
Write a LocalDate property to the POF stream in ISO8601 format.This method encodes the year, month and day information of the specified LocalDate object. No time or timezone information is encoded.
- Parameters:
iProp
- the property indexdt
- the LocalDate property value to write in ISO8601 format- Throws:
IllegalArgumentException
- if the property index is invalid, or is less than or equal to the index of the previous property written to the POF streamIOException
- if an I/O error occurs
-
writeDateTime
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 indexdt
- the Date property value to write in ISO8601 format- Throws:
IllegalArgumentException
- if the property index is invalid, or is less than or equal to the index of the previous property written to the POF streamIOException
- if an I/O error occurs
-
writeDateTime
Write a LocalDateTime property to the POF stream in ISO8601 format.This method encodes the year, month, day, hour, minute, second and millisecond information of the specified LocalDateTime object. No timezone information is encoded.
- Parameters:
iProp
- the property indexdt
- the LocalDateTime property value to write in ISO8601 format- Throws:
IllegalArgumentException
- if the property index is invalid, or is less than or equal to the index of the previous property written to the POF streamIOException
- if an I/O error occurs
-
writeDateTime
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 indexdt
- the Timestamp property value to write in ISO8601 format- Throws:
IllegalArgumentException
- if the property index is invalid, or is less than or equal to the index of the previous property written to the POF streamIOException
- if an I/O error occurs
-
writeDateTimeWithZone
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 indexdt
- the Date property value to write in ISO8601 format- Throws:
IllegalArgumentException
- if the property index is invalid, or is less than or equal to the index of the previous property written to the POF streamIOException
- if an I/O error occurs
-
writeDateTimeWithZone
Write a OffsetDateTime 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 OffsetDateTime object.
- Parameters:
iProp
- the property indexdt
- the OffsetDateTime property value to write in ISO8601 format- Throws:
IllegalArgumentException
- if the property index is invalid, or is less than or equal to the index of the previous property written to the POF streamIOException
- if an I/O error occurs
-
writeDateTimeWithZone
Write a ZonedDateTime 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 ZonedDateTime object.
- Parameters:
iProp
- the property indexdt
- the ZonedDateTime property value to write in ISO8601 format- Throws:
IllegalArgumentException
- if the property index is invalid, or is less than or equal to the index of the previous property written to the POF streamIOException
- if an I/O error occurs
-
writeDateTimeWithZone
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 indexdt
- the Timestamp property value to write in ISO8601 format- Throws:
IllegalArgumentException
- if the property index is invalid, or is less than or equal to the index of the previous property written to the POF streamIOException
- if an I/O error occurs
-
writeTime
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 indexdt
- the Date property value to write in ISO8601 format- Throws:
IllegalArgumentException
- if the property index is invalid, or is less than or equal to the index of the previous property written to the POF streamIOException
- if an I/O error occurs
-
writeTime
Write a LocalTime property to the POF stream in ISO8601 format.This method encodes the hour, minute, second and millisecond information of the specified LocalTime object. No year, month, day or timezone information is encoded.
- Parameters:
iProp
- the property indexdt
- the LocalTime property value to write in ISO8601 format- Throws:
IllegalArgumentException
- if the property index is invalid, or is less than or equal to the index of the previous property written to the POF streamIOException
- if an I/O error occurs
-
writeTime
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 indexdt
- the Timestamp property value to write in ISO8601 format- Throws:
IllegalArgumentException
- if the property index is invalid, or is less than or equal to the index of the previous property written to the POF streamIOException
- if an I/O error occurs
-
writeTimeWithZone
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 indexdt
- the Date property value to write in ISO8601 format- Throws:
IllegalArgumentException
- if the property index is invalid, or is less than or equal to the index of the previous property written to the POF streamIOException
- if an I/O error occurs
-
writeTimeWithZone
Write a OffsetTime property to the POF stream in ISO8601 format.This method encodes the hour, minute, second, millisecond and timezone information of the specified OffsetTime object. No year, month or day information is encoded.
- Parameters:
iProp
- the property indexdt
- the OffsetTime property value to write in ISO8601 format- Throws:
IllegalArgumentException
- if the property index is invalid, or is less than or equal to the index of the previous property written to the POF streamIOException
- if an I/O error occurs
-
writeTimeWithZone
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 indexdt
- the Timestamp property value to write in ISO8601 format- Throws:
IllegalArgumentException
- if the property index is invalid, or is less than or equal to the index of the previous property written to the POF streamIOException
- if an I/O error occurs
-
writeRawDate
Write a RawDate property to the POF stream.- Parameters:
iProp
- the property indexdate
- the RawDate property value to write- Throws:
IllegalArgumentException
- if the property index is invalid, or is less than or equal to the index of the previous property written to the POF streamIOException
- if an I/O error occurs
-
writeRawTime
Write a RawTime property to the POF stream.- Parameters:
iProp
- the property indextime
- the RawTime property value to write- Throws:
IllegalArgumentException
- if the property index is invalid, or is less than or equal to the index of the previous property written to the POF streamIOException
- if an I/O error occurs
-
writeRawDateTime
Write a RawDateTime property to the POF stream.- Parameters:
iProp
- the property indexdt
- the RawDateTime property value to write- Throws:
IllegalArgumentException
- if the property index is invalid, or is less than or equal to the index of the previous property written to the POF streamIOException
- if an I/O error occurs
-
writeRawYearMonthInterval
Write a RawYearMonthInterval property to the POF stream.- Parameters:
iProp
- the property indexinterval
- the RawYearMonthInterval property value to write- Throws:
IllegalArgumentException
- if the property index is invalid, or is less than or equal to the index of the previous property written to the POF streamIOException
- if an I/O error occurs
-
writeRawTimeInterval
Write a RawTimeInterval property to the POF stream.- Parameters:
iProp
- the property indexinterval
- the RawTimeInterval property value to write- Throws:
IllegalArgumentException
- if the property index is invalid, or is less than or equal to the index of the previous property written to the POF streamIOException
- if an I/O error occurs
-
writeRawDayTimeInterval
Write a RawDayTimeInterval property to the POF stream.- Parameters:
iProp
- the property indexinterval
- the RawDayTimeInterval property value to write- Throws:
IllegalArgumentException
- if the property index is invalid, or is less than or equal to the index of the previous property written to the POF streamIOException
- if an I/O error occurs
-
writeObject
Write an Object property to the POF stream.The given object must be an instance of one of the following:
- boolean[]
- byte[]
- char[]
- short[]
- int[]
- long[]
- float[]
- double[]
- Boolean
- Byte
- Char
- Short
- Integer
- Long
- BigInteger
- Float
- Double
RawQuad
- BigDecimal
Binary
- String
- Date
RawDate
RawTime
RawDateTime
RawYearMonthInterval
RawTimeInterval
RawDayTimeInterval
- Collection
LongArray
PortableObject
Otherwise, a
PofSerializer
for the object must be obtainable from thePofContext
associated with this PofWriter.- Parameters:
iProp
- the property indexo
- the Object property to write- Throws:
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; or if the given property cannot be encoded into a POF streamIOException
- if an I/O error occurs
-
writeObjectArray
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:
- boolean[]
- byte[]
- char[]
- short[]
- int[]
- long[]
- float[]
- double[]
- Boolean
- Byte
- Char
- Short
- Integer
- Long
- BigInteger
- Float
- Double
RawQuad
- BigDecimal
Binary
- String
- Date
RawDate
RawTime
RawDateTime
RawYearMonthInterval
RawTimeInterval
RawDayTimeInterval
- Collection
LongArray
PortableObject
Otherwise, a
PofSerializer
for each element of the array must be obtainable from thePofContext
associated with this PofWriter.- Type Parameters:
T
- type of the elements in the array- Parameters:
iProp
- the property indexao
- the Object[] property to write- Throws:
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; or if the given property cannot be encoded into a POF streamIOException
- if an I/O error occurs
-
writeObjectArray
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:
- boolean[]
- byte[]
- char[]
- short[]
- int[]
- long[]
- float[]
- double[]
- Boolean
- Byte
- Char
- Short
- Integer
- Long
- BigInteger
- Float
- Double
RawQuad
- BigDecimal
Binary
- String
- Date
RawDate
RawTime
RawDateTime
RawYearMonthInterval
RawTimeInterval
RawDayTimeInterval
- Collection
LongArray
PortableObject
Otherwise, a
PofSerializer
for each element of the array must be obtainable from thePofContext
associated with this PofWriter.Additionally, the type of each element must be equal to the specified class.
- Type Parameters:
T
- the type of the elements in the array- Parameters:
iProp
- the property indexao
- the Object[] property to writeclz
- the class of all elements; must not be null- Throws:
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; if the given property cannot be encoded into a POF stream; or if the type of one or more elements of the array is not equal to the specified classIOException
- if an I/O error occurs
-
writeCollection
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:
- boolean[]
- byte[]
- char[]
- short[]
- int[]
- long[]
- float[]
- double[]
- Boolean
- Byte
- Char
- Short
- Integer
- Long
- BigInteger
- Float
- Double
RawQuad
- BigDecimal
Binary
- String
- Date
RawDate
RawTime
RawDateTime
RawYearMonthInterval
RawTimeInterval
RawDayTimeInterval
- Collection
LongArray
PortableObject
Otherwise, a
PofSerializer
for each element of the Collection must be obtainable from thePofContext
associated with this PofWriter.- Type Parameters:
T
- the type of elements in Collection- Parameters:
iProp
- the property indexcoll
- the Collection property to write- Throws:
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; or if the given property cannot be encoded into a POF streamIOException
- if an I/O error occurs
-
writeCollection
<T> void writeCollection(int iProp, Collection<? extends T> coll, Class<? extends T> clz) throws 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:
- boolean[]
- byte[]
- char[]
- short[]
- int[]
- long[]
- float[]
- double[]
- Boolean
- Byte
- Char
- Short
- Integer
- Long
- BigInteger
- Float
- Double
RawQuad
- BigDecimal
Binary
- String
- Date
RawDate
RawTime
RawDateTime
RawYearMonthInterval
RawTimeInterval
RawDayTimeInterval
- Collection
LongArray
PortableObject
Otherwise, a
PofSerializer
for each element of the Collection must be obtainable from thePofContext
associated with this PofWriter.Additionally, the type of each element must be equal to the specified class.
- Type Parameters:
T
- the type of elements in the Collection- Parameters:
iProp
- the property indexcoll
- the Collection property to writeclz
- the class of all elements; must not be null- Throws:
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; if the given property cannot be encoded into a POF stream; or if the type of one or more elements of the Collection is not equal to the specified classIOException
- if an I/O error occurs
-
writeLongArray
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:
- boolean[]
- byte[]
- char[]
- short[]
- int[]
- long[]
- float[]
- double[]
- Boolean
- Byte
- Char
- Short
- Integer
- Long
- BigInteger
- Float
- Double
RawQuad
- BigDecimal
Binary
- String
- Date
RawDate
RawTime
RawDateTime
RawYearMonthInterval
RawTimeInterval
RawDayTimeInterval
- Collection
LongArray
PortableObject
Otherwise, a
PofSerializer
for each element of the LongArray must be obtainable from thePofContext
associated with this PofWriter.- Type Parameters:
T
- the type of elements in LongArray- Parameters:
iProp
- the property indexla
- the LongArray property to write- Throws:
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; or if the given property cannot be encoded into a POF streamIOException
- if an I/O error occurs
-
writeLongArray
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:
- boolean[]
- byte[]
- char[]
- short[]
- int[]
- long[]
- float[]
- double[]
- Boolean
- Byte
- Char
- Short
- Integer
- Long
- BigInteger
- Float
- Double
RawQuad
- BigDecimal
Binary
- String
- Date
RawDate
RawTime
RawDateTime
RawYearMonthInterval
RawTimeInterval
RawDayTimeInterval
- Collection
LongArray
PortableObject
Otherwise, a
PofSerializer
for each element of the LongArray must be obtainable from thePofContext
associated with this PofWriter.Additionally, the type of each element must be equal to the specified class.
- Type Parameters:
T
- the type of elements in LongArray- Parameters:
iProp
- the property indexla
- the LongArray property to writeclz
- the class of all elements; must not be null- Throws:
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; if the given property cannot be encoded into a POF stream; or if the type of one or more elements of the LongArray is not equal to the specified classIOException
- if an I/O error occurs
-
writeMap
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:
- boolean[]
- byte[]
- char[]
- short[]
- int[]
- long[]
- float[]
- double[]
- Boolean
- Byte
- Char
- Short
- Integer
- Long
- BigInteger
- Float
- Double
RawQuad
- BigDecimal
Binary
- String
- Date
RawDate
RawTime
RawDateTime
RawYearMonthInterval
RawTimeInterval
RawDayTimeInterval
- Collection
LongArray
PortableObject
Otherwise, a
PofSerializer
for each key and value of the Map must be obtainable from thePofContext
associated with this PofWriter.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
iProp
- the property indexmap
- the Map property to write- Throws:
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; or if the given property cannot be encoded into a POF streamIOException
- if an I/O error occurs
-
writeMap
<K,V> void writeMap(int iProp, Map<K, ? extends V> map, Class<? extends K> clzKey) throws IOExceptionWrite 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:
- boolean[]
- byte[]
- char[]
- short[]
- int[]
- long[]
- float[]
- double[]
- Boolean
- Byte
- Char
- Short
- Integer
- Long
- BigInteger
- Float
- Double
RawQuad
- BigDecimal
Binary
- String
- Date
RawDate
RawTime
RawDateTime
RawYearMonthInterval
RawTimeInterval
RawDayTimeInterval
- Collection
LongArray
PortableObject
Otherwise, a
PofSerializer
for each key and value of the Map must be obtainable from thePofContext
associated with this PofWriter.Additionally, the type of each key must be equal to the specified class.
- Type Parameters:
K
- the key typeV
- the value type- Parameters:
iProp
- the property indexmap
- the Map property to writeclzKey
- the class of all keys; must not be null- Throws:
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; if the given property cannot be encoded into a POF stream; or if the type of one or more keys is not equal to the specified classIOException
- if an I/O error occurs
-
writeMap
<K,V> void writeMap(int iProp, Map<K, V> map, Class<? extends K> clzKey, Class<? extends V> clzValue) throws IOExceptionWrite 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:
- boolean[]
- byte[]
- char[]
- short[]
- int[]
- long[]
- float[]
- double[]
- Boolean
- Byte
- Char
- Short
- Integer
- Long
- BigInteger
- Float
- Double
RawQuad
- BigDecimal
Binary
- String
- Date
RawDate
RawTime
RawDateTime
RawYearMonthInterval
RawTimeInterval
RawDayTimeInterval
- Collection
LongArray
PortableObject
Otherwise, a
PofSerializer
for each key and value of the Map must be obtainable from thePofContext
associated with this PofWriter.Additionally, the type of each key and value must be equal to the specified key class and value class respectively.
- Type Parameters:
K
- the key typeV
- the value type- Parameters:
iProp
- the property indexmap
- the Map property to writeclzKey
- the class of all keys; must not be nullclzValue
- the class of all values; must not be null- Throws:
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; if the given property cannot be encoded into a POF stream; or if the type of one or more keys or values of the Map is not equal to the specified key or value classIOException
- 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
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:
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:
IllegalArgumentException
- if the given version ID is negativeIllegalStateException
- if no user type is being written
-
createNestedPofWriter
Obtain a PofWriter that can be used to write a set of properties into a single property of the current user type. The returned PofWriter is only valid from the time that it is returned until the next call is made to this PofWriter.- Parameters:
iProp
- the property index- Returns:
- a PofWriter whose contents are nested into a single property of this PofWriter
- Throws:
IllegalArgumentException
- if the property index is invalid, or is less than or equal to the index of the previous property written to the POF streamIllegalStateException
- if no user type is being writtenIOException
- if an I/O error occurs- Since:
- Coherence 3.6
-
createNestedPofWriter
Obtain a PofWriter that can be used to write a set of properties into a single property of the current user type. The returned PofWriter is only valid from the time that it is returned until the next call is made to this PofWriter.- Parameters:
iProp
- the property indexnTypeId
- the type identifier of the nested property- Returns:
- a PofWriter whose contents are nested into a single property of this PofWriter
- Throws:
IllegalArgumentException
- if the property index is invalid, or is less than or equal to the index of the previous property written to the POF streamIllegalStateException
- if no user type is being writtenIOException
- if an I/O error occurs- Since:
- Coherence 12.2.1
-
writeRemainder
Write the remaining properties to the POF stream, terminating the writing of the current 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:
IllegalStateException
- if no user type is being writtenIOException
- if an I/O error occurs
-