title: Parsing a file with BodyParser in Scala Play20 with new lines
body: <p>Excuse the n00bness of this question, but I have a web application where I want to send a potentially large file to the server and have it parse the format.  I'm using the Play20 framework and I'm new to Scala.</p>
  
  <p>For example, if I have a csv, I'd like to split each row by "," and ultimately create a <code>List[List[String]]</code> with each field. </p>
  
  <p>Currently, I'm thinking the best way to do this is with a BodyParser (but I could be wrong).    My code looks something like:</p>
  
  <pre><code>Iteratee.fold[String, List[List[String]]]() {
    (result, chunk) =&gt;
      result = chunk.splitByNewLine.splitByDelimiter // Psuedocode
  }
  </code></pre>
  
  <p>My first question is, how do I deal with a situation like the one below where a chunk has been split in the middle of a line:</p>
  
  <pre><code>Chunk 1:
  1,2,3,4\n
  5,6
  
  Chunk 2:
  7,8\n
  9,10,11,12\n
  </code></pre>
  
  <p>My second question is, is writing my own BodyParser the right way to go about this?  Are there better ways of parsing this file?  My main concern is that I want to allow the files to be very large so I can flush a buffer at some point and not keep the entire file in memory.</p>