Class MessageTokenizerBase
- java.lang.Object
-
- com.sportradar.livedata.sdk.proto.common.MessageTokenizerBase
-
- All Implemented Interfaces:
MessageTokenizer
- Direct Known Subclasses:
IncrementalMessageTokenizer
public abstract class MessageTokenizerBase extends Object implements MessageTokenizer
Represents a message tokenizer base.
-
-
Field Summary
Fields Modifier and Type Field Description protected MessageTokenizerListener
listener
AMessageTokenizerListener
implementation used to observe currentMessageTokenizerBase
class.
-
Constructor Summary
Constructors Constructor Description MessageTokenizerBase()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
notifyListener(InputStream stream)
Notifies the observer that data was tokenized.abstract void
processData(InputStream stream)
Processes passed data.void
setListener(MessageTokenizerListener listener)
Sets the listener used to observer thisMessageTokenizerListener
implementation.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.sportradar.livedata.sdk.proto.common.MessageTokenizer
clear
-
-
-
-
Field Detail
-
listener
protected volatile MessageTokenizerListener listener
AMessageTokenizerListener
implementation used to observe currentMessageTokenizerBase
class.
-
-
Method Detail
-
setListener
public void setListener(MessageTokenizerListener listener)
Sets the listener used to observer thisMessageTokenizerListener
implementation.- Specified by:
setListener
in interfaceMessageTokenizer
- Parameters:
listener
- the listener used to observer thisMessageTokenizerListener
implementation.
-
processData
public abstract void processData(InputStream stream) throws SdkException
Processes passed data. If passed data and any previously stored data represent a whole message theMessageTokenizerListener.onMessageReady(byte[])
method is invoked- Specified by:
processData
in interfaceMessageTokenizer
- Parameters:
stream
- AInputStream
containing data to be tokenized.- Throws:
IllegalArgumentException
- thestream
is a null reference.ProtocolException
- the data could not be processed either because the buffer is fullProtocolException
- 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 messageSdkException
-
notifyListener
protected void notifyListener(InputStream stream) throws SdkException
Notifies the observer that data was tokenized.- Parameters:
stream
- AInputStream
instance containing the tokenized data.- Throws:
SdkException
- thrown when an un-expected situation is encountered.
-
-