public class ApiDeserializer extends Object
| Constructor and Description |
|---|
ApiDeserializer() |
| Modifier and Type | Method and Description |
|---|---|
<T extends BasicMessage> |
deserialize(InputStream input)
Reads a JSON string in
Hawkular format that
is found in the given input stream and converts the JSON string to a particular message object. |
<T extends BasicMessage> |
deserialize(String nameAndJson)
Deserializes a JSON string in
Hawkular format. |
static String |
toHawkularFormat(BasicMessage msg)
Returns a string that encodes the given object as a JSON message but then
prefixes that JSON with additional information that a Hawkular client will
need to be able to deserialize the JSON.
|
static BinaryData |
toHawkularFormat(BasicMessage msg,
InputStream extraData)
Returns a BinaryData object (which is a stream) that encodes the given message
just like
toHawkularFormat(BasicMessage) does but also packages the given
input stream as extra data with the JSON message. |
public static String toHawkularFormat(BasicMessage msg)
deserialize(String).msg - the message object that will be serialized into JSONpublic static BinaryData toHawkularFormat(BasicMessage msg, InputStream extraData)
toHawkularFormat(BasicMessage) does but also packages the given
input stream as extra data with the JSON message.
The returned object can be used to deserialize the msg and extra data via deserialize(InputStream).msg - the message object that will be serialized into JSONextraData - the extra data to be packages with the given messagepublic <T extends BasicMessage> BasicMessageWithExtraData<T> deserialize(String nameAndJson)
Hawkular format.
The JSON object is returned.nameAndJson - the string to be deserializedpublic <T extends BasicMessage> BasicMessageWithExtraData<T> deserialize(InputStream input)
Hawkular format that
is found in the given input stream and converts the JSON string to a particular message object.
The input stream will remain open so the caller can stream any extra data that might appear after it.
Because of the way the JSON parser works, some extra data might have been read from the stream
that wasn't part of the JSON message but was part of the extra data that came with it. Because of this,
the caller should no longer use the given stream but instead read the extra data via the returned
object (see BasicMessageWithExtraData.getBinaryData()) since it will handle this condition
properly.in - input stream that has the Hawkular formatted JSON string at the head.BinaryData object that you
can use to stream any additional data that came in the given input stream.Copyright © 2014–2017 Red Hat, Inc.. All rights reserved.