Class JaxbMessageParser<T extends MessageBase>
- java.lang.Object
-
- com.sportradar.livedata.sdk.proto.common.MessageParserBase<T>
-
- com.sportradar.livedata.sdk.proto.common.JaxbMessageParser<T>
-
- All Implemented Interfaces:
MessageParser<T>
public class JaxbMessageParser<T extends MessageBase> extends MessageParserBase<T>
AMessageParser
implementation which uses JAXB to un-marshal the messages
-
-
Constructor Summary
Constructors Constructor Description JaxbMessageParser(JaxbBuilder builder, MessageTokenizer tokenizer)
Initializes a new instance of theJaxbMessageParser
class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getEncoding()
Gets the configured character encoding for the parser.protected void
onDataReady(InputStream stream)
Processes the received data.protected void
unMarshallData(InputStream stream)
When overridden in derived class it un-marshals thedata
.-
Methods inherited from class com.sportradar.livedata.sdk.proto.common.MessageParserBase
clear, notifyMessageReady, processData, setListener
-
-
-
-
Constructor Detail
-
JaxbMessageParser
public JaxbMessageParser(JaxbBuilder builder, MessageTokenizer tokenizer)
Initializes a new instance of theJaxbMessageParser
class.- Parameters:
builder
- TheJaxbBuilder
implementation used to construct theUnmarshaller
instances.tokenizer
- TheMessageTokenizer
implementation used to tokenize received data, or a null reference.- Throws:
IllegalArgumentException
- thebuilder
is a null reference orbufferSize
is smaller than or equal to 0.
-
-
Method Detail
-
unMarshallData
protected void unMarshallData(InputStream stream) throws SdkException
When overridden in derived class it un-marshals thedata
.- Parameters:
stream
- AInputStream
instance containing message data.- Throws:
ProtocolException
- the exception was thrown while un-marshaling thedata
.SdkException
-
onDataReady
protected void onDataReady(InputStream stream) throws SdkException
Processes the received data.- Specified by:
onDataReady
in classMessageParserBase<T extends MessageBase>
- Parameters:
stream
- AInputStream
implementation containing the received data.- Throws:
SdkException
- thrown when an un-expected situation is encountered.
-
getEncoding
public String getEncoding()
Gets the configured character encoding for the parser.- Returns:
- - a string, i.e. UTF-8
-
-