Class MessageParserBase<T extends MessageBase>

    • Constructor Detail

      • MessageParserBase

        protected MessageParserBase​(MessageTokenizer tokenizer)
        Initializes a new instance of the MessageParserBase class.
        Parameters:
        tokenizer - A MessageTokenizer implementation used to tokenize received data, or a null reference.
    • Method Detail

      • onDataReady

        protected abstract void onDataReady​(InputStream stream)
                                     throws SdkException
        When overridden in derived class, it processes the received data.
        Parameters:
        stream - A InputStream implementation containing the received data.
        Throws:
        SdkException - thrown when an un-expected situation is encountered.
      • notifyMessageReady

        protected void notifyMessageReady​(T message)
        Notifies the attached observer that message was successfully parsed.
        Parameters:
        message - the parsed message
      • processData

        public final void processData​(InputStream stream)
                               throws SdkException
        Processes passed data. If passed data and any previously stored data represent a whole message the MessageParserListener.onMessageReady(T) method is invoked
        Specified by:
        processData in interface MessageParser<T extends MessageBase>
        Parameters:
        stream - A InputStream instance containing message data.
        Throws:
        IllegalArgumentException - the stream is 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
        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
      • clear

        public void clear()
        Removes any data potentially left in the parser's buffer.
        Specified by:
        clear in interface MessageParser<T extends MessageBase>