|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.fudgemsg.AlternativeFudgeStreamWriter
public abstract class AlternativeFudgeStreamWriter
Abstract implementation of a FudgeStreamWriter
that detects major state changes and invokes
other methods. Can be used to build alternative stream writers for converting streamed Fudge messages
to XML, JSON or other formats.
Constructor Summary | |
---|---|
protected |
AlternativeFudgeStreamWriter(FudgeContext fudgeContext)
Creates a new AlternativeFudgeStreamWriter instance. |
Method Summary | |
---|---|
void |
close()
No action taken. |
void |
envelopeComplete()
Signal the end of the message contained within an envelope. |
void |
flush()
No action taken. |
protected void |
fudgeEnvelopeEnd()
Called at the end of the envelope after all fields have been processed. |
protected void |
fudgeEnvelopeStart(int processingDirectives,
int schemaVersion)
Called when a Fudge message envelope is starting. |
protected void |
fudgeFieldEnd()
Called after a field has been processed. |
protected boolean |
fudgeFieldStart(Short ordinal,
String name,
FudgeFieldType<?> type)
Called as a field starts. |
protected void |
fudgeFieldValue(FudgeFieldType<?> type,
Object fieldValue)
Called between fudgeFieldStart(java.lang.Short, java.lang.String, org.fudgemsg.FudgeFieldType>) and fudgeFieldEnd() for fields that are not sub messages. |
protected void |
fudgeSubMessageEnd()
Called when a sub-message has been processed, before fudgeFieldEnd() is called for the field. |
protected void |
fudgeSubMessageStart()
Called after fudgeFieldStart(java.lang.Short, java.lang.String, org.fudgemsg.FudgeFieldType>) when a sub-message is starting. |
FudgeTaxonomy |
getCurrentTaxonomy()
Returns the taxonomy (if any) that is currently being used to encode fields. |
int |
getCurrentTaxonomyId()
Returns the current taxonomy identifier. |
FudgeContext |
getFudgeContext()
Returns the bound FudgeContext used for type and taxonomy resolution. |
void |
setCurrentTaxonomyId(int taxonomyId)
Sets the current taxonomy, by identifier, to be used to encode fields. |
void |
writeEnvelopeHeader(int processingDirectives,
int schemaVersion,
int messageSize)
Writes a message envelope header. |
void |
writeField(FudgeField field)
Writes a message field. |
void |
writeField(Short ordinal,
String name,
FudgeFieldType type,
Object fieldValue)
Writes a message field. |
void |
writeFields(FudgeFieldContainer msg)
Writes a set of fields. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected AlternativeFudgeStreamWriter(FudgeContext fudgeContext)
AlternativeFudgeStreamWriter
instance.
fudgeContext
- the associated FudgeContext
Method Detail |
---|
public void close()
close
in interface Closeable
close
in interface FudgeStreamWriter
public void flush()
flush
in interface Flushable
flush
in interface FudgeStreamWriter
public FudgeContext getFudgeContext()
FudgeContext
used for type and taxonomy resolution.
getFudgeContext
in interface FudgeStreamWriter
FudgeContext
public FudgeTaxonomy getCurrentTaxonomy()
null
if no taxonomy is specified or the taxonomy identifier cannot be resolved by the bound FudgeContext
.
getCurrentTaxonomy
in interface FudgeStreamWriter
FudgeTaxonomy
public void setCurrentTaxonomyId(int taxonomyId)
setCurrentTaxonomyId
in interface FudgeStreamWriter
taxonomyId
- the taxonomy identifierpublic int getCurrentTaxonomyId()
getCurrentTaxonomyId
in interface FudgeStreamWriter
public void writeEnvelopeHeader(int processingDirectives, int schemaVersion, int messageSize)
writeEnvelopeHeader
in interface FudgeStreamWriter
processingDirectives
- the processing directive flagsschemaVersion
- the schema version valuemessageSize
- the Fudge encoded size of the underlying message, including the message envelopepublic void envelopeComplete()
envelopeComplete
in interface FudgeStreamWriter
public void writeFields(FudgeFieldContainer msg)
writeFields
in interface FudgeStreamWriter
msg
- the fields to write.public void writeField(FudgeField field)
writeField
in interface FudgeStreamWriter
field
- the message field to writepublic void writeField(Short ordinal, String name, FudgeFieldType type, Object fieldValue)
writeField
in interface FudgeStreamWriter
ordinal
- the ordinal index of the field, or null
to omit.name
- the name of the field, null
to omit. If the ordinal is omitted and the name matches an entry in the current taxonomy the name will be replaced by the taxonomy resolved ordinal.type
- the type of the underlying datafieldValue
- value of the fieldprotected void fudgeEnvelopeStart(int processingDirectives, int schemaVersion)
processingDirectives
- the envelope processing directivesschemaVersion
- the envelope schema versionprotected void fudgeEnvelopeEnd()
protected boolean fudgeFieldStart(Short ordinal, String name, FudgeFieldType<?> type)
ordinal
- the field ordinalname
- the field nametype
- the field type
true
to continue processing the field, false
to ignore it (fudgeFieldValue(org.fudgemsg.FudgeFieldType>, java.lang.Object)
, fudgeSubMessageStart()
, fudgeSubMessageEnd()
and fudgeFieldEnd()
will not be called for this field)protected void fudgeFieldEnd()
protected void fudgeFieldValue(FudgeFieldType<?> type, Object fieldValue)
fudgeFieldStart(java.lang.Short, java.lang.String, org.fudgemsg.FudgeFieldType>)
and fudgeFieldEnd()
for fields that are not sub messages.
type
- the field typefieldValue
- the valueprotected void fudgeSubMessageStart()
fudgeFieldStart(java.lang.Short, java.lang.String, org.fudgemsg.FudgeFieldType>)
when a sub-message is starting.
protected void fudgeSubMessageEnd()
fudgeFieldEnd()
is called for the field.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |