title: Apache Spark's RDD splitting according to the particular size
body: <p>I am trying to read strings from a text file, but I want to limit each line according to a particular size. For example;</p>
  
  <p>Here is my representing the file.</p>
  
  <blockquote>
    <p>aaaaa\nbbb\nccccc</p>
  </blockquote>
  
  <p>When trying to read this file by sc.textFile, RDD would appear this one.</p>
  
  <pre><code>scala&gt; val rdd = sc.textFile("textFile")
  scala&gt; rdd.collect
  res1: Array[String] = Array(aaaaa, bbb, ccccc)
  </code></pre>
  
  <p>But I want to limit the size of this RDD. For example, if the limit is 3, then I should get like this one.</p>
  
  <pre><code>Array[String] = Array(aaa, aab, bbc, ccc, c)
  </code></pre>
  
  <p>What is the best performance way to do that?</p>