title: Text File Parsing in Java
body: <p>I am reading in a text file using <code>FileInputStream</code> that puts the file contents into a byte array.  I then convert the byte array into a String using new String(byte).  </p>
  
  <p>Once I have the string I'm using <code>String.split("\n")</code> to split the file into a String array and then taking that string array and parsing it by doing a <code>String.split(",")</code> and hold the contents in an Arraylist.  </p>
  
  <p>I have a <em>200MB+</em> file and it is running out of memory when I start the JVM up with a 1GB of memory.  I know I must be doing something in correctly somewhere, I'm just not sure if the way I'm parsing is incorrect or the data structure I'm using.  </p>
  
  <p>It is also taking me about 12 seconds to parse the file which seems like a lot of time.  Can anyone point out what I may be doing that is causing me to run out of memory and what may be causing my program to run slow?</p>
  
  <p>The contents of the file look as shown below:</p>
  
  <pre><code>"12334", "100", "1.233", "TEST", "TEXT", "1234"
  "12334", "100", "1.233", "TEST", "TEXT", "1234"
  .
  .
  .
  "12334", "100", "1.233", "TEST", "TEXT", "1234"
  </code></pre>
  
  <p>Thanks</p>