title: Java CSV: Read/Write CSV with multiple header lines
body: <p>I'm a noob in CSV processing using Java.</p>
  <p>How can I read/write multiple header CSV in Java. For example:</p>
  <p>Data in hand after multiple joins (say from a table).</p>
  <pre><code>-------------------------------------------------------------
  |student_id | name | year | subject_id | marks| total_marks |
  -------------------------------------------------------------
  |STD01      | ABC  |2001  | SUB01      | 80   | 155         |
  |STD01      | ABC  |2001  | SUB02      | 75   | 155         |
  |STD02      | XYZ  |2001  | SUB01      | 85   | 85          |
  -------------------------------------------------------------
  </code></pre>
  <p>The above data to be represented in below format in CSV - they differ in the first column which identifies them either as ALL or IND</p>
  <pre><code>ALL, STUDENT_ID, NAME, YEAR, TOTAL_MARKS
  IND, STUDRNT_ID, NAME, YEAR, SUBJECT_ID, MARKS
  ALL, STD01, ABC, 2001, 155
  IND, STD01, ABC, 2001, SUB01, 80
  IND, STD01, ABC, 2001, SUB02, 75
  ALL, STD02, XYZ, 2001, 85
  IND, STD02, XYZ, 2001, SUB01, 85
  </code></pre>
  <p>Exporting them as the joined table would mean I have the ALL column in every line which is not desired.</p>
  <p>Any clues or useful tools suggestion much appreciated!</p>