title: How can I get my inputstream result of a http request outside the string buffer input loop
body: <p>I'm using openstreetmap
  I can only see the inputstream inside the while loop</p>
  
  <p>Here's my code inside the initialize of the javafx Controller:</p>
  
  <pre><code>try {
      URL myurl;
      myurl = new URL("https://nominatim.openstreetmap.org/search?q=The+White+House,+Washington+DC&amp;amp;format=json&amp;amp;addressdetails=1");
      URLConnection yc = myurl.openConnection();
      BufferedReader in = new BufferedReader(new InputStreamReader(yc.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
  
      while ((inputLine = in.readLine()) != null)
                  response.append(inputLine);
  
  } catch (IOException ex) {
      Logger.getLogger(WeatherUpdateController.class.getName()).log(Level.SEVERE, null, ex);
  }
  </code></pre>
  
  <p>I am trying to get the StringBuffer inside a string variable so I can search it.</p>