Package org.apache.axis2.json
Class AbstractJSONDataSource
java.lang.Object
org.apache.axis2.json.AbstractJSONDataSource
- All Implemented Interfaces:
org.apache.axiom.om.OMDataSource
- Direct Known Subclasses:
JSONBadgerfishDataSource,JSONDataSource
public abstract class AbstractJSONDataSource
extends Object
implements org.apache.axiom.om.OMDataSource
JSONDataSource keeps the JSON String inside and consumes it when needed. This is to be kept in
the OMSourcedElementImpl and can be used either to expand the tree or get the JSON String
directly without expanding. This uses the "Mapped" JSON convention.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Stringabstract XMLStreamReaderGives the StAX reader using the "Mapped" formatted input JSON String.voidserialize(OutputStream outputStream, org.apache.axiom.om.OMOutputFormat omOutputFormat) Writes JSON into the output stream.voidWrites JSON through the writer.voidserialize(XMLStreamWriter xmlStreamWriter) Writes XML through the XMLStreamWriter.
-
Field Details
-
localName
-
-
Constructor Details
-
AbstractJSONDataSource
-
-
Method Details
-
serialize
public void serialize(OutputStream outputStream, org.apache.axiom.om.OMOutputFormat omOutputFormat) throws XMLStreamException Writes JSON into the output stream. As this should write JSON, it directly gets the JSON string and writes it without expanding the tree.- Specified by:
serializein interfaceorg.apache.axiom.om.OMDataSource- Parameters:
outputStream- the stream to be written intoomOutputFormat- format of the message, this is ignored.- Throws:
XMLStreamException- if there is an error while writing the message in to the output stream.
-
serialize
public void serialize(Writer writer, org.apache.axiom.om.OMOutputFormat omOutputFormat) throws XMLStreamException Writes JSON through the writer. As this should write JSON, it directly gets the JSON string and writes it without expanding the tree.- Specified by:
serializein interfaceorg.apache.axiom.om.OMDataSource- Parameters:
writer- Writer to be written intoomOutputFormat- format of the message, this is ignored.- Throws:
XMLStreamException- if there is an error while writing the message through the writer.
-
serialize
Writes XML through the XMLStreamWriter. As the input data source is JSON, this method needs to get a StAX reader from that JSON String. Therefore this uses the getReader() method to get the StAX reader writes the events into the XMLStreamWriter.- Specified by:
serializein interfaceorg.apache.axiom.om.OMDataSource- Parameters:
xmlStreamWriter- StAX writer to be written into- Throws:
XMLStreamException- if there is an error while writing the message through the StAX writer.
-
getReader
Gives the StAX reader using the "Mapped" formatted input JSON String.- Specified by:
getReaderin interfaceorg.apache.axiom.om.OMDataSource- Returns:
- The XMLStreamReader according to the JSON String.
- Throws:
XMLStreamException- if there is an error while making the StAX reader.
-
getJSONString
-
getCompleteJOSNString
-