title: How to convert a TCP inputstream into a UPD datgram byte array?
body: <p>I have some string to convert to stream which I use</p>
  
  <pre><code>outputStream.write(string.getBytes(Charset.forName("UTF-8")));
  </code></pre>
  
  <p>and send through TCP socket, and then the server convert these stream to byte array and send to UDP socket. The problem is because the origional string size varies, and I don't want to define the byte array size. What's most optimized way to do the later one.</p>