Class MessageParserBase<T extends MessageBase>
java.lang.Object
com.sportradar.livedata.sdk.proto.common.MessageParserBase<T>
- All Implemented Interfaces:
- MessageParser<T>
- Direct Known Subclasses:
- JaxbMessageParser
public abstract class MessageParserBase<T extends MessageBase>
extends Object
implements MessageParser<T>
Represents a base class for message parsers.
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedMessageParserBase(MessageTokenizer tokenizer) Initializes a new instance of theMessageParserBaseclass.
- 
Method SummaryModifier and TypeMethodDescriptionvoidclear()Removes any data potentially left in the parser's buffer.protected voidnotifyMessageReady(T message) Notifies the attached observer that message was successfully parsed.protected abstract voidonDataReady(InputStream stream) When overridden in derived class, it processes the received data.final voidprocessData(InputStream stream) Processes passed data.voidsetListener(MessageParserListener<T> listener) Sets theMessageParserListenerinstance used to observe the currentMessageParserBaseMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.sportradar.livedata.sdk.proto.common.MessageParsergetEncoding
- 
Constructor Details- 
MessageParserBaseInitializes a new instance of theMessageParserBaseclass.- Parameters:
- tokenizer- A- MessageTokenizerimplementation used to tokenize received data, or a null reference.
 
 
- 
- 
Method Details- 
onDataReadyWhen overridden in derived class, it processes the received data.- Parameters:
- stream- A- InputStreamimplementation containing the received data.
- Throws:
- SdkException- thrown when an un-expected situation is encountered.
 
- 
notifyMessageReadyNotifies the attached observer that message was successfully parsed.- Parameters:
- message- the parsed message
 
- 
processDataProcesses passed data. If passed data and any previously stored data represent a whole message theMessageParserListener.onMessageReady(T)method is invoked- Specified by:
- processDatain interface- MessageParser<T extends MessageBase>
- Parameters:
- stream- A- InputStreaminstance containing message data.
- Throws:
- IllegalArgumentException- the- streamis a null reference.
- ProtocolException- the data could not be processed either because the buffer is full, an un-expected character was encountered or there was an error while un-marshalling the message
- SdkException
 
- 
clearpublic void clear()Removes any data potentially left in the parser's buffer.- Specified by:
- clearin interface- MessageParser<T extends MessageBase>
 
- 
setListenerSets theMessageParserListenerinstance used to observe the currentMessageParserBase- Specified by:
- setListenerin interface- MessageParser<T extends MessageBase>
- Parameters:
- listener- The- MessageParserListenerinstance used to observe the current- MessageParserBaseor a null reference.
 
 
-