title: Reading data from multiple urls using BufferedReader
body: <p>I have two static blocks in my class that load data from two URLs. I want to use a single static block, and read the data efficiently. Any thoughts on how this can be done?</p>
  
  <pre><code>static {    
  
      URL urlA = null;
      String data = "";       
      try {
          url = new URL(urlA);            
          BufferedReader in = new BufferedReader(new InputStreamReader(urlA.openStream()));
          String inputLine;
          while ((inputLine = in.readLine()) != null) {
              data = data + inputLine;
          }
      } catch (MalformedURLException mue) {
          e.printStackTrace();
      } catch (IOException ioe) {
          e.printStackTrace();
      }
      //Do stuff with the data
  }
  
  static {    
  
      URL urlB = null;
      String data = "";       
      try {
          url = new URL(urlB);            
          BufferedReader in = new BufferedReader(new InputStreamReader(urlB.openStream()));
          String inputLine;
          while ((inputLine = in.readLine()) != null) {
              data = data + inputLine;
          }
      } catch (MalformedURLException mue) {
          e.printStackTrace();
      } catch (IOException ioe) {
          e.printStackTrace();
      }
      //Do stuff with the data
  }
  </code></pre>