|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.fudgemsg.json.FudgeJSONStreamReader
public class FudgeJSONStreamReader
A FudgeStreamReader implementation for decoding a stream of JSON encoded text into Fudge messages.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.fudgemsg.FudgeStreamReader |
---|
FudgeStreamReader.FudgeStreamElement |
Constructor Summary | |
---|---|
FudgeJSONStreamReader(FudgeContext fudgeContext,
Reader reader)
|
|
FudgeJSONStreamReader(FudgeContext fudgeContext,
Reader underlying,
JSONSettings settings)
|
Method Summary | |
---|---|
void |
close()
Closes the FudgeStreamReader and attempts to close the underlying data source if appropriate. |
FudgeStreamReader.FudgeStreamElement |
getCurrentElement()
Returns the value last returned by FudgeStreamReader.next() . |
String |
getFieldName()
If the current stream element is a field, returns the field name. |
Integer |
getFieldOrdinal()
If the current stream element is a field, returns the ordinal index, or null if the field did not include an ordinal. |
FudgeFieldType<?> |
getFieldType()
If the current stream element is a field, returns the FudgeFieldType . |
Object |
getFieldValue()
If the current stream element is a field, returns the field value. |
FudgeContext |
getFudgeContext()
Returns the FudgeContext bound to the reader used for type and taxonomy resolution. |
int |
getProcessingDirectives()
Returns the processing directivies specified in the last envelope header read. |
int |
getSchemaVersion()
Returns the schema version specified in the last envelope header read. |
JSONSettings |
getSettings()
|
FudgeTaxonomy |
getTaxonomy()
Returns the current FudgeTaxonomy corresponding to the taxonomy identifier specified in the message envelope. |
short |
getTaxonomyId()
Returns the taxonomy identifier specified in the last envelope header read. |
protected org.json.JSONTokener |
getTokener()
|
protected Reader |
getUnderlying()
|
boolean |
hasNext()
Returns true if there is at least one more element to be returned by a call to FudgeStreamReader.next() . |
FudgeStreamReader.FudgeStreamElement |
next()
Reads the next stream element from the source and returns the element type. |
protected FudgeStreamReader.FudgeStreamElement |
setCurrentElement(FudgeStreamReader.FudgeStreamElement currentElement)
|
protected void |
setCurrentFieldName(String name)
|
protected void |
setEnvelopeFields(int processingDirectives,
int schemaVersion,
int taxonomyId)
|
protected void |
setFieldValue(Object object)
|
protected RuntimeException |
wrapException(String message,
org.json.JSONException e)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FudgeJSONStreamReader(FudgeContext fudgeContext, Reader underlying, JSONSettings settings)
public FudgeJSONStreamReader(FudgeContext fudgeContext, Reader reader)
Method Detail |
---|
protected Reader getUnderlying()
protected org.json.JSONTokener getTokener()
public void close()
FudgeStreamReader
FudgeStreamReader
and attempts to close the underlying data source if appropriate.
close
in interface Closeable
close
in interface FudgeStreamReader
protected RuntimeException wrapException(String message, org.json.JSONException e)
public FudgeStreamReader.FudgeStreamElement getCurrentElement()
FudgeStreamReader
FudgeStreamReader.next()
.
getCurrentElement
in interface FudgeStreamReader
protected FudgeStreamReader.FudgeStreamElement setCurrentElement(FudgeStreamReader.FudgeStreamElement currentElement)
public String getFieldName()
FudgeStreamReader
getFieldName
in interface FudgeStreamReader
protected void setCurrentFieldName(String name)
public Integer getFieldOrdinal()
FudgeStreamReader
null
if the field did not include an ordinal.
getFieldOrdinal
in interface FudgeStreamReader
public FudgeFieldType<?> getFieldType()
FudgeStreamReader
FudgeFieldType
.
getFieldType
in interface FudgeStreamReader
public Object getFieldValue()
FudgeStreamReader
getFieldValue
in interface FudgeStreamReader
protected void setFieldValue(Object object)
public FudgeContext getFudgeContext()
FudgeStreamReader
FudgeContext
bound to the reader used for type and taxonomy resolution.
getFudgeContext
in interface FudgeStreamReader
FudgeContext
public int getProcessingDirectives()
FudgeStreamReader
getProcessingDirectives
in interface FudgeStreamReader
public int getSchemaVersion()
FudgeStreamReader
getSchemaVersion
in interface FudgeStreamReader
public FudgeTaxonomy getTaxonomy()
FudgeStreamReader
FudgeTaxonomy
corresponding to the taxonomy identifier specified in the message envelope. Returns
null
if the message did not specify a taxonomy or the taxonomy identifier cannot be resolved by the bound FudgeContext
.
getTaxonomy
in interface FudgeStreamReader
protected void setEnvelopeFields(int processingDirectives, int schemaVersion, int taxonomyId)
public short getTaxonomyId()
FudgeStreamReader
getTaxonomyId
in interface FudgeStreamReader
public boolean hasNext()
FudgeStreamReader
Returns true if there is at least one more element to be returned by a call to FudgeStreamReader.next()
. A return of false
indicates the end of a message (or submessage) has been reached. After the end of a sub-message, the next immediate call will
indicate whether there are further elements or the end of the outer message. After the end of the main message referenced by
the envelope header, the next immediate call may:
false
if the source does not contain any subsequent Fudge messages; ortrue
if the source may contain further Fudge messages. Calling next()
will return the envelope header
of the next message if one is present, or null
if the source does not contain any further messages.
hasNext
in interface FudgeStreamReader
true
if there is at least one more element to readpublic FudgeStreamReader.FudgeStreamElement next()
FudgeStreamReader
next
in interface FudgeStreamReader
null
if the end of stream has been reached at a message
boundary (i.e. attempting to read the first byte of an envelope)public JSONSettings getSettings()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |