code: public void readData(DataInput din) throws IOException {
  
          // Get the size of any device-specific data.
          m_length = din.readUnsignedByte();
          if (m_length < 2 || m_length > 255) {
              return;
          }
  
          // Get the run status and device identifier.
          m_slaveId = din.readUnsignedByte();
          m_status = din.readUnsignedByte();
  
          /*
           * The device-specific data is two bytes shorter than the
           * length read previously.  That length includes the run status
           * and slave ID.
           */
          m_data = new byte[m_length - 2];
          if (m_length > 2) {
              din.readFully(m_data, 0, m_length - 2);
          }
      }
docs: readData -- input the Modbus message from din.  If there was a
  header, such as for Modbus/TCP, it will have been read
  already.
  @throws java.io.IOException If the data cannot be read