title: How to read file of size more than 100 MB efficiently in Java
body: <p>Hey I am using Java 8 in my spring boot application. I am getting data from apache server through an HTTP call. Data size sometime is more than 100 MB (more than 100 000 lines). I need to convert that data into list of string. For smaller data below code is working but for larger it is giving</p>
  <blockquote>
  <p>java.lang.OutOfMemoryError: Java heap space</p>
  </blockquote>
  <p>This is how i am converting the data into List of string.</p>
  <pre><code>List&lt;String&gt; lines = null;
  try {
      String data = con.sendGet();
  
      
      if(data==null)
          throw new UserAuthException(&quot;diff is not available at the location&quot;);
  
      else {
          diff.setLineAsString(data);
          lines = IOUtils.readLines(new StringReader(data));
          System.out.println(&quot;lines = IOUtils.readLines(new StringReader(data));&quot;);
      }
  } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
  }  
  </code></pre>
  <p>Does IOUtils run in memory? what is the efficient way to read it?</p>