|
CoherenceTM v3.3 Copyright© 2000-2007 by Oracle Corporation |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.tangosol.util.Base
com.tangosol.io.pof.PofHelper
com.tangosol.io.pof.PofBufferWriter
public class PofBufferWriter
PofWriter
implementation that writes POF-encoded data to a
BufferOutput
.
Nested Class Summary | |
---|---|
static class |
PofBufferWriter.UserTypeWriter
The UserTypeWriter implementation is a contextually-aware PofWriter whose purpose is to write the properties of a value of a specified user type. |
Nested classes/interfaces inherited from class com.tangosol.io.pof.PofHelper |
---|
PofHelper.ReadableEntrySetMap, PofHelper.WriteableEntrySetMap |
Field Summary | |
---|---|
protected PofContext |
m_ctx
The PofContext used by this PofBufferWriter to serialize user types. |
protected WritingPofHandler |
m_handler
The WritingPofHandler used to write a POF stream. |
protected WriteBuffer.BufferOutput |
m_out
The BufferOutput object that the PofBufferWriter writes to. |
Fields inherited from class com.tangosol.io.pof.PofHelper |
---|
BIGDECIMAL_ZERO, BINARY_EMPTY, BOOLEAN_ARRAY_EMPTY, BYTE_ARRAY_EMPTY, CHAR_ARRAY_EMPTY, COLLECTION_EMPTY, DOUBLE_ARRAY_EMPTY, FLOAT_ARRAY_EMPTY, INT_ARRAY_EMPTY, LONG_ARRAY_EMPTY, OBJECT_ARRAY_EMPTY, SHORT_ARRAY_EMPTY |
Constructor Summary | |
---|---|
PofBufferWriter(WriteBuffer.BufferOutput out,
PofContext ctx)
Construct a new PofBufferWriter that will write a POF stream to the passed BufferOutput object. |
|
PofBufferWriter(WritingPofHandler handler,
PofContext ctx)
Construct a new PofBufferWriter that will write a POF stream using the passed WritingPofHandler. |
Method Summary | |
---|---|
protected static void |
assertEqual(Class clz,
Class clzTest)
Assert that a class is equal to another class. |
protected void |
beginProperty(int iProp)
Report that a POF property is about to be written to the POF stream. |
protected void |
endProperty(int iProp)
Signifies the termination of the current POF property. |
protected WriteBuffer.BufferOutput |
getBufferOutput()
Return the BufferOutput that this PofBufferWriter writes to. |
PofContext |
getPofContext()
Return the PofContext object used by this PofWriter to serialize user types to a POF stream. |
protected WritingPofHandler |
getPofHandler()
Return the WritingPofHandler used internally by this PofBufferWriter to write the 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. |
protected void |
onException(Exception e)
Called when an unexpected exception is caught while writing to the POF stream. |
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 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,
Collection coll)
Write a Collection property to the POF stream. |
void |
writeCollection(int iProp,
Collection coll,
Class clz)
Write a uniform Collection property to the POF stream. |
void |
writeDate(int iProp,
Date dt)
Write a Date 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 |
writeDateTime(int iProp,
Timestamp dt)
Write a Timestamp 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 |
writeDateTimeWithZone(int iProp,
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,
Class clz)
Write a uniform LongArray property to the POF stream. |
void |
writeMap(int iProp,
Map map)
Write a Map property to the POF stream. |
void |
writeMap(int iProp,
Map map,
Class clzKey)
Write a uniform key Map property to the POF stream. |
void |
writeMap(int iProp,
Map map,
Class clzKey,
Class clzValue)
Write a uniform Map property to the POF stream. |
void |
writeObject(int iProp,
Object o)
Write an Object property to the POF stream. |
void |
writeObjectArray(int iProp,
Object[] ao)
Write an Object[] property to the POF stream. |
void |
writeObjectArray(int iProp,
Object[] ao,
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,
String s)
Write a String property to the POF stream. |
void |
writeTime(int iProp,
Date dt)
Write a Date property to the POF stream in ISO8601 format. |
void |
writeTime(int iProp,
Timestamp dt)
Write a Timestamp 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. |
void |
writeTimeWithZone(int iProp,
Timestamp dt)
Write a Timestamp property to the POF stream in ISO8601 format. |
Field Detail |
---|
protected WriteBuffer.BufferOutput m_out
protected PofContext m_ctx
protected WritingPofHandler m_handler
Constructor Detail |
---|
public PofBufferWriter(WriteBuffer.BufferOutput out, PofContext ctx)
out
- the BufferOutput object to write to; must not be nullctx
- the PofContext used by the new PofBufferWriter to
serialize user types; must not be nullpublic PofBufferWriter(WritingPofHandler handler, PofContext ctx)
handler
- the WritingPofHandler used for writing; must not be nullctx
- the PofContext used by the new PofBufferWriter to
serialize user types; must not be nullMethod Detail |
---|
public void writeBoolean(int iProp, boolean f) throws IOException
writeBoolean
in interface PofWriter
iProp
- the property indexf
- the boolean property value to write
IOException
- if an I/O error occurspublic void writeByte(int iProp, byte b) throws IOException
writeByte
in interface PofWriter
iProp
- the property indexb
- the byte property value to write
IOException
- if an I/O error occurspublic void writeChar(int iProp, char ch) throws IOException
writeChar
in interface PofWriter
iProp
- the property indexch
- the char property value to write
IOException
- if an I/O error occurspublic void writeShort(int iProp, short n) throws IOException
writeShort
in interface PofWriter
iProp
- the property indexn
- the short property value to write
IOException
- if an I/O error occurspublic void writeInt(int iProp, int n) throws IOException
writeInt
in interface PofWriter
iProp
- the property indexn
- the int property value to write
IOException
- if an I/O error occurspublic void writeLong(int iProp, long n) throws IOException
writeLong
in interface PofWriter
iProp
- the property indexn
- the long property value to write
IOException
- if an I/O error occurspublic void writeFloat(int iProp, float fl) throws IOException
writeFloat
in interface PofWriter
iProp
- the property indexfl
- the float property value to write
IOException
- if an I/O error occurspublic void writeDouble(int iProp, double dfl) throws IOException
writeDouble
in interface PofWriter
iProp
- the property indexdfl
- the double property value to write
IOException
- if an I/O error occurspublic void writeBooleanArray(int iProp, boolean[] af) throws IOException
writeBooleanArray
in interface PofWriter
iProp
- the property indexaf
- the boolean[] property value to write
IOException
- if an I/O error occurspublic void writeByteArray(int iProp, byte[] ab) throws IOException
writeByteArray
in interface PofWriter
iProp
- the property indexab
- the byte[] property value to write
IOException
- if an I/O error occurspublic void writeCharArray(int iProp, char[] ach) throws IOException
writeCharArray
in interface PofWriter
iProp
- the property indexach
- the char[] property value to write
IOException
- if an I/O error occurspublic void writeShortArray(int iProp, short[] an) throws IOException
writeShortArray
in interface PofWriter
iProp
- the property indexan
- the short[] property value to write
IOException
- if an I/O error occurspublic void writeIntArray(int iProp, int[] an) throws IOException
writeIntArray
in interface PofWriter
iProp
- the property indexan
- the int[] property value to write
IOException
- if an I/O error occurspublic void writeLongArray(int iProp, long[] an) throws IOException
writeLongArray
in interface PofWriter
iProp
- the property indexan
- the long[] property value to write
IOException
- if an I/O error occurspublic void writeFloatArray(int iProp, float[] afl) throws IOException
writeFloatArray
in interface PofWriter
iProp
- the property indexafl
- the float[] property value to write
IOException
- if an I/O error occurspublic void writeDoubleArray(int iProp, double[] adfl) throws IOException
writeDoubleArray
in interface PofWriter
iProp
- the property indexadfl
- the double[] property value to write
IOException
- if an I/O error occurspublic void writeBigInteger(int iProp, BigInteger n) throws IOException
writeBigInteger
in interface PofWriter
iProp
- the property indexn
- the BigInteger property value to write
IOException
- if an I/O error occurspublic void writeRawQuad(int iProp, RawQuad qfl) throws IOException
writeRawQuad
in interface PofWriter
iProp
- the property indexqfl
- the RawQuad property value to write
IOException
- if an I/O error occurspublic void writeBigDecimal(int iProp, BigDecimal dec) throws IOException
writeBigDecimal
in interface PofWriter
iProp
- the property indexdec
- the BigDecimal property value to write
IOException
- if an I/O error occurspublic void writeBinary(int iProp, Binary bin) throws IOException
Binary
property to the POF stream.
writeBinary
in interface PofWriter
iProp
- the property indexbin
- the Binary property value to write
IOException
- if an I/O error occurspublic void writeString(int iProp, String s) throws IOException
writeString
in interface PofWriter
iProp
- the property indexs
- the String property value to write
IOException
- if an I/O error occurspublic void writeDate(int iProp, Date dt) throws IOException
writeDate
in interface PofWriter
iProp
- the property indexdt
- the Date property value to write in ISO8601 format
IOException
- if an I/O error occurspublic void writeDateTime(int iProp, Date dt) throws IOException
writeDateTime
in interface PofWriter
iProp
- the property indexdt
- the Date property value to write in ISO8601 format
IOException
- if an I/O error occurspublic void writeDateTime(int iProp, Timestamp dt) throws IOException
writeDateTime
in interface PofWriter
iProp
- the property indexdt
- the Timestamp property value to write in ISO8601
format
IOException
- if an I/O error occurspublic void writeDateTimeWithZone(int iProp, Date dt) throws IOException
writeDateTimeWithZone
in interface PofWriter
iProp
- the property indexdt
- the Date property value to write in ISO8601 format
IOException
- if an I/O error occurspublic void writeDateTimeWithZone(int iProp, Timestamp dt) throws IOException
writeDateTimeWithZone
in interface PofWriter
iProp
- the property indexdt
- the Timestamp property value to write in ISO8601
format
IOException
- if an I/O error occurspublic void writeTime(int iProp, Date dt) throws IOException
writeTime
in interface PofWriter
iProp
- the property indexdt
- the Date property value to write in ISO8601 format
IOException
- if an I/O error occurspublic void writeTime(int iProp, Timestamp dt) throws IOException
writeTime
in interface PofWriter
iProp
- the property indexdt
- the Timestamp property value to write in ISO8601
format
IOException
- if an I/O error occurspublic void writeTimeWithZone(int iProp, Date dt) throws IOException
writeTimeWithZone
in interface PofWriter
iProp
- the property indexdt
- the Date property value to write in ISO8601 format
IOException
- if an I/O error occurspublic void writeTimeWithZone(int iProp, Timestamp dt) throws IOException
writeTimeWithZone
in interface PofWriter
iProp
- the property indexdt
- the Timestamp property value to write in ISO8601
format
IOException
- if an I/O error occurspublic void writeRawDate(int iProp, RawDate date) throws IOException
writeRawDate
in interface PofWriter
iProp
- the property indexdate
- the RawDate property value to write
IOException
- if an I/O error occurspublic void writeRawTime(int iProp, RawTime time) throws IOException
writeRawTime
in interface PofWriter
iProp
- the property indextime
- the RawTime property value to write
IOException
- if an I/O error occurspublic void writeRawDateTime(int iProp, RawDateTime dt) throws IOException
writeRawDateTime
in interface PofWriter
iProp
- the property indexdt
- the RawDateTime property value to write
IOException
- if an I/O error occurspublic void writeRawYearMonthInterval(int iProp, RawYearMonthInterval interval) throws IOException
writeRawYearMonthInterval
in interface PofWriter
iProp
- the property indexinterval
- the RawYearMonthInterval property value to write
IOException
- if an I/O error occurspublic void writeRawTimeInterval(int iProp, RawTimeInterval interval) throws IOException
writeRawTimeInterval
in interface PofWriter
iProp
- the property indexinterval
- the RawTimeInterval property value to write
IOException
- if an I/O error occurspublic void writeRawDayTimeInterval(int iProp, RawDayTimeInterval interval) throws IOException
writeRawDayTimeInterval
in interface PofWriter
iProp
- the property indexinterval
- the RawDayTimeInterval property value to write
IOException
- if an I/O error occurspublic void writeObject(int iProp, Object o) throws IOException
RawQuad
Binary
RawDate
RawTime
RawDateTime
RawYearMonthInterval
RawTimeInterval
RawDayTimeInterval
LongArray
PortableObject
PofSerializer
for the object must be obtainable from
the PofContext
associated with this PofWriter.
writeObject
in interface PofWriter
iProp
- the property indexo
- the Object property to write
IOException
- if an I/O error occurspublic void writeObjectArray(int iProp, Object[] ao) throws IOException
RawQuad
Binary
RawDate
RawTime
RawDateTime
RawYearMonthInterval
RawTimeInterval
RawDayTimeInterval
LongArray
PortableObject
PofSerializer
for each element of the array must be
obtainable from the PofContext
associated with this PofWriter.
writeObjectArray
in interface PofWriter
iProp
- the property indexao
- the Object[] property to write
IOException
- if an I/O error occurspublic void writeObjectArray(int iProp, Object[] ao, Class clz) throws IOException
RawQuad
Binary
RawDate
RawTime
RawDateTime
RawYearMonthInterval
RawTimeInterval
RawDayTimeInterval
LongArray
PortableObject
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.
writeObjectArray
in interface PofWriter
iProp
- the property indexao
- the Object[] property to writeclz
- the class of all elements; must not be null
IOException
- if an I/O error occurspublic void writeCollection(int iProp, Collection coll) throws IOException
RawQuad
Binary
RawDate
RawTime
RawDateTime
RawYearMonthInterval
RawTimeInterval
RawDayTimeInterval
LongArray
PortableObject
PofSerializer
for each element of the Collection
must be obtainable from the PofContext
associated with this
PofWriter.
writeCollection
in interface PofWriter
iProp
- the property indexcoll
- the Collection property to write
IOException
- if an I/O error occurspublic void writeCollection(int iProp, Collection coll, Class clz) throws IOException
RawQuad
Binary
RawDate
RawTime
RawDateTime
RawYearMonthInterval
RawTimeInterval
RawDayTimeInterval
LongArray
PortableObject
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.
writeCollection
in interface PofWriter
iProp
- the property indexcoll
- the Collection property to writeclz
- the class of all elements; must not be null
IOException
- if an I/O error occurspublic void writeLongArray(int iProp, LongArray la) throws IOException
PofWriter
RawQuad
Binary
RawDate
RawTime
RawDateTime
RawYearMonthInterval
RawTimeInterval
RawDayTimeInterval
LongArray
PortableObject
PofSerializer
for each element of the LongArray
must be obtainable from the PofContext
associated with this
PofWriter.
writeLongArray
in interface PofWriter
iProp
- the property indexla
- the LongArray property to write
IOException
- if an I/O error occurspublic void writeLongArray(int iProp, LongArray la, Class clz) throws IOException
PofWriter
RawQuad
Binary
RawDate
RawTime
RawDateTime
RawYearMonthInterval
RawTimeInterval
RawDayTimeInterval
LongArray
PortableObject
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.
writeLongArray
in interface PofWriter
iProp
- the property indexla
- the LongArray property to writeclz
- the class of all elements; must not be null
IOException
- if an I/O error occurspublic void writeMap(int iProp, Map map) throws IOException
RawQuad
Binary
RawDate
RawTime
RawDateTime
RawYearMonthInterval
RawTimeInterval
RawDayTimeInterval
LongArray
PortableObject
PofSerializer
for each key and value of the Map must
be obtainable from the PofContext
associated with this PofWriter.
writeMap
in interface PofWriter
iProp
- the property indexmap
- the Map property to write
IOException
- if an I/O error occurspublic void writeMap(int iProp, Map map, Class clzKey) throws IOException
RawQuad
Binary
RawDate
RawTime
RawDateTime
RawYearMonthInterval
RawTimeInterval
RawDayTimeInterval
LongArray
PortableObject
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.
writeMap
in interface PofWriter
iProp
- the property indexmap
- the Map property to writeclzKey
- the class of all keys; must not be null
IOException
- if an I/O error occurspublic void writeMap(int iProp, Map map, Class clzKey, Class clzValue) throws IOException
RawQuad
Binary
RawDate
RawTime
RawDateTime
RawYearMonthInterval
RawTimeInterval
RawDayTimeInterval
LongArray
PortableObject
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.
writeMap
in interface PofWriter
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
IOException
- if an I/O error occurspublic PofContext getPofContext()
getPofContext
in interface PofWriter
public void setPofContext(PofContext ctx)
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); }
setPofContext
in interface PofWriter
ctx
- the new PofContext; must not be nullpublic int getUserTypeId()
getUserTypeId
in interface PofWriter
public int getVersionId()
getVersionId
in interface PofWriter
public void setVersionId(int nVersionId)
setVersionId
in interface PofWriter
nVersionId
- the user type identifier; must be non-negativepublic void writeRemainder(Binary binProps) throws IOException
writeRemainder
in interface PofWriter
binProps
- a Binary object containing zero or more indexed
properties in binary POF encoded form; may be null
IOException
- if an I/O error occursprotected void beginProperty(int iProp) throws IOException
endProperty(int)
.
iProp
- the index of the property being written
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
IOException
- if an I/O error occursprotected void endProperty(int iProp)
iProp
- the index of the current propertyprotected void onException(Exception e) throws IOException
e
- the exception
IOException
- the wrapped IOException, if the given exception is
a wrapped IOExceptionprotected static void assertEqual(Class clz, Class clzTest)
clz
- the expected class; must not be nullclzTest
- the class to test for equality; must not be null
IllegalArgumentException
- if the second class is not equal to
the firstprotected WriteBuffer.BufferOutput getBufferOutput()
protected WritingPofHandler getPofHandler()
|
CoherenceTM v3.3 Copyright© 2000-2007 by Oracle Corporation |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |