|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.fudgemsg.AlternativeFudgeStreamWriter
org.fudgemsg.json.FudgeJSONStreamWriter
public class FudgeJSONStreamWriter
A FudgeStreamWriter
implementation for generating JSON representations of
Fudge messages. Please refer to JSON Fudge Messages for details on
the representation.
Constructor Summary | |
---|---|
FudgeJSONStreamWriter(FudgeContext fudgeContext,
Writer writer)
Creates a new stream writer for writing Fudge messages in JSON format to a given Writer . |
|
FudgeJSONStreamWriter(FudgeContext fudgeContext,
Writer writer,
JSONSettings settings)
Creates a new stream writer for writing Fudge messages in JSON format to a given Writer . |
Method Summary | |
---|---|
protected void |
clearWriter()
Discards the JSON writer. |
void |
flush()
No action taken. |
protected void |
fudgeEnvelopeEnd()
Ends the JSON object. |
protected void |
fudgeEnvelopeStart(int processingDirectives,
int schemaVersion)
Begins a JSON object with the processing directives, schema and taxonomy. |
protected boolean |
fudgeFieldStart(Short ordinal,
String name,
FudgeFieldType<?> type)
Writes out the field name to the JSON object. |
protected void |
fudgeFieldValue(FudgeFieldType<?> type,
Object fieldValue)
Writes the field value to the JSON object. |
protected void |
fudgeSubMessageEnd()
Ends the JSON sub-object. |
protected void |
fudgeSubMessageStart()
Starts a sub-object within the JSON object. |
JSONSettings |
getSettings()
Returns the settings object |
protected Writer |
getUnderlying()
Returns the underlying Writer that is wrapped by JSONWriter instances for
messages. |
protected org.json.JSONWriter |
getWriter()
Returns the JSON writer being used, allocating one if necessary. |
protected void |
wrapException(String message,
org.json.JSONException e)
Wraps a JSON exception (which may in turn wrap IOExceptions into either a FudgeRuntimeException or FudgeRuntimeIOException . |
protected void |
writeArray(byte[] data)
|
protected void |
writeArray(double[] data)
|
protected void |
writeArray(float[] data)
|
protected void |
writeArray(int[] data)
|
protected void |
writeArray(long[] data)
|
protected void |
writeArray(short[] data)
|
Methods inherited from class org.fudgemsg.AlternativeFudgeStreamWriter |
---|
close, envelopeComplete, fudgeFieldEnd, getCurrentTaxonomy, getCurrentTaxonomyId, getFudgeContext, setCurrentTaxonomyId, writeEnvelopeHeader, writeField, writeField, writeFields |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FudgeJSONStreamWriter(FudgeContext fudgeContext, Writer writer)
Writer
.
fudgeContext
- the associated FudgeContext
writer
- the target to write topublic FudgeJSONStreamWriter(FudgeContext fudgeContext, Writer writer, JSONSettings settings)
Writer
.
fudgeContext
- the associated FudgeContext
writer
- the target to write toMethod Detail |
---|
public JSONSettings getSettings()
protected org.json.JSONWriter getWriter()
protected void clearWriter()
protected Writer getUnderlying()
Writer
that is wrapped by JSONWriter
instances for
messages.
protected void wrapException(String message, org.json.JSONException e)
IOExceptions
into either a FudgeRuntimeException
or FudgeRuntimeIOException
.
message
- message describing the current operatione
- the originating exceptionpublic void flush()
flush
in interface Flushable
flush
in interface FudgeStreamWriter
flush
in class AlternativeFudgeStreamWriter
protected void fudgeEnvelopeStart(int processingDirectives, int schemaVersion)
fudgeEnvelopeStart
in class AlternativeFudgeStreamWriter
processingDirectives
- the envelope processing directivesschemaVersion
- the envelope schema versionprotected void fudgeEnvelopeEnd()
fudgeEnvelopeEnd
in class AlternativeFudgeStreamWriter
protected boolean fudgeFieldStart(Short ordinal, String name, FudgeFieldType<?> type)
fudgeFieldStart
in class AlternativeFudgeStreamWriter
ordinal
- the field ordinalname
- the field nametype
- the field type
true
to continue processing the field, false
to ignore it (AlternativeFudgeStreamWriter.fudgeFieldValue(org.fudgemsg.FudgeFieldType>, java.lang.Object)
, AlternativeFudgeStreamWriter.fudgeSubMessageStart()
, AlternativeFudgeStreamWriter.fudgeSubMessageEnd()
and AlternativeFudgeStreamWriter.fudgeFieldEnd()
will not be called for this field)protected void writeArray(byte[] data) throws org.json.JSONException
org.json.JSONException
protected void writeArray(short[] data) throws org.json.JSONException
org.json.JSONException
protected void writeArray(int[] data) throws org.json.JSONException
org.json.JSONException
protected void writeArray(long[] data) throws org.json.JSONException
org.json.JSONException
protected void writeArray(float[] data) throws org.json.JSONException
org.json.JSONException
protected void writeArray(double[] data) throws org.json.JSONException
org.json.JSONException
protected void fudgeFieldValue(FudgeFieldType<?> type, Object fieldValue)
fudgeFieldValue
in class AlternativeFudgeStreamWriter
type
- the field typefieldValue
- the valueprotected void fudgeSubMessageStart()
fudgeSubMessageStart
in class AlternativeFudgeStreamWriter
protected void fudgeSubMessageEnd()
fudgeSubMessageEnd
in class AlternativeFudgeStreamWriter
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |