title: Using StringReader to read to the end of String
body: <p>How can I use a StringReader in Java to read to the end of a string, where I don't know what the length of the string will be.</p>
  
  <p>This is how far I've gotten so far:</p>
  
  <pre><code>public static boolean portForward(Device dev, int localPort, int remotePort)
  {
      boolean success = false;
      AdbCommand adbCmd = Adb.formAdbCommand(dev, "forward", "tcp:" + localPort, "tcp:" + remotePort);
      StringReader reader = new StringReader(executeAdbCommand(adbCmd));
      try
      {
          if (/*This is what's missing :/ */)
          {
              success = true;
          }
      } catch (Exception ex) {
          JOptionPane.showMessageDialog(null, "There was an error while retrieving the list of devices.\n" + ex + "\nPlease report this error to the developer/s.", "Error Retrieving Devices", JOptionPane.ERROR_MESSAGE);
      } finally {
          reader.close();
      }
  
      return success;
  }
  </code></pre>