类 StreamTransport

java.lang.Object
com.huangjian.modbus4j.sero.messaging.StreamTransport
所有已实现的接口:
Transport, Runnable
直接已知子类:
StreamTransportCharSpaced, TestableTransport

public class StreamTransport extends Object implements Transport, Runnable
First, instatiate with the streams. Then add a data consumer, or create a message control and pass this as the transport (which will make the message control the data consumer). Change the read delay if desired. This class supports running in its own thread (start) or an external one (run), say from a thread pool. Both approaches are delegated to the stream listener. In either case, stop the transport with the stop method (or just stop the message control).
  • 字段详细资料

  • 构造器详细资料

  • 方法详细资料

    • setReadDelay

      public void setReadDelay(int readDelay)

      setReadDelay.

      参数:
      readDelay - a int.
    • start

      public void start(String threadName)

      start.

      参数:
      threadName - a String object.
    • stop

      public void stop()

      stop.

    • run

      public void run()

      run.

      指定者:
      run 在接口中 Runnable
    • setConsumer

      public void setConsumer(DataConsumer consumer)

      setConsumer.

      指定者:
      setConsumer 在接口中 Transport
      参数:
      consumer - a DataConsumer object.
    • removeConsumer

      public void removeConsumer()

      removeConsumer.

      指定者:
      removeConsumer 在接口中 Transport
    • write

      public void write(byte[] data) throws IOException

      write.

      指定者:
      write 在接口中 Transport
      参数:
      data - an array of
      引用无效
      byte
      objects.
      抛出:
      IOException - if any.
    • write

      public void write(byte[] data, int len) throws IOException

      write.

      指定者:
      write 在接口中 Transport
      参数:
      data - an array of
      引用无效
      byte
      objects.
      len - a int.
      抛出:
      IOException - if any.