title: Kotlin not receiving a full packet from an HC-06 Bluetooth module
body: <p>In Kotlin I am having an issue with data not fully loading into the buffer in Android in one packet. I am sending &lt;7:16> data packet from a HC-06 bluetooth module.
  When i receive it's coming in as 2 packets. The micro is sending a CR and LF and the end of the transmission.</p>
  
  <pre><code>I/UI_Msg: &lt;  
  I/UI_Msg: 7:16&gt;  
  I/UI_Msg: &lt;  
  I/UI_Msg: 7:16&gt;  
  etc
  </code></pre>
  
  <p>If I add a sleep command for a second, then query the buffer it comes in completed in one packet.  The problem is I want to send more than one packet in a second.. </p>
  
  <p>How can i fix this issue to or can i just build a string until '>' is received from the buffer.</p>
  
  <pre><code>private fun beginListenForData() {
    val handler = Handler()
      stopThread = false
      buffer = ByteArray(10)
      val thread = Thread(Runnable {
          while (!Thread.currentThread().isInterrupted &amp;&amp; !stopThread) {
              try {
                  val byteCount = inputStream!!.available()
                  if (byteCount &gt; 0) {
                      //Thread.sleep(1000)      // wait for buffer finish filling
                      val rawBytes = ByteArray(byteCount)
                      inputStream!!.read(rawBytes)
                      val string = String(rawBytes, StandardCharsets.UTF_8)
                      //handler.post {txt_message.text=""}
                      Log.i(TAG,""+ string)
                      //handler.post {txt_message.append(string)}
                     // processInput(string)
                  }
              } catch (ex: IOException) {
                  stopThread = true
              }
          }
  
      })
  
      thread.start()
  
  }
  </code></pre>