title: Equivalent of fgets in Java
body: <p>I wrote a serial communication program in MATLAB and now want to translate it in Java. I have translated the rest of the code but failed with this part:</p>
  
  <pre><code>fprintf(s,'C');
  x = fgets(s);
  </code></pre>
  
  <p>where x is the response I would like to get from a serial device and
        s is my serial object</p>
  
  <p>I would really appreciate any help.</p>
  
  <p>Thanks</p>