类 BaseMessageParser

java.lang.Object
com.huangjian.modbus4j.base.BaseMessageParser
所有已实现的接口:
MessageParser
直接已知子类:
AsciiMessageParser, EncapMessageParser, RtuMessageParser, XaMessageParser

public abstract class BaseMessageParser extends Object implements MessageParser

Abstract BaseMessageParser class.

  • 字段详细资料

    • master

      protected final boolean master
  • 构造器详细资料

    • BaseMessageParser

      public BaseMessageParser(boolean master)

      Constructor for BaseMessageParser.

      参数:
      master - a boolean.
  • 方法详细资料

    • parseMessage

      public IncomingMessage parseMessage(ByteQueue queue) throws Exception
      Attempt to parse a message out of the queue. Data in the queue may be discarded if it is unusable (i.e. a start indicator is not found), but otherwise if a message is not found due to the data being incomplete, the method should return null. As additional data arrives, it will be appended to the queue and this method will be called again. Implementations should not modify the queue unless it is safe to do so. No copy of the data is made before calling this method.
      指定者:
      parseMessage 在接口中 MessageParser
      参数:
      queue - the queue from which to access data for the creation of the message
      返回:
      the message if one was able to be created, or null otherwise.
      抛出:
      Exception - if the data in the queue is sufficient to construct a message, but the message data is invalid, this method must throw an exception, or it will keep getting the same data.
    • parseMessageImpl

      protected abstract IncomingMessage parseMessageImpl(ByteQueue queue) throws Exception

      parseMessageImpl.

      参数:
      queue - a ByteQueue object.
      返回:
      a IncomingMessage object.
      抛出:
      Exception - if any.