Parsing files in java/android
<p>I have a text file that has is set out like the following</p>

<pre><code>Title - Welcome to the Dibb
Date - 13/03/11
Information - Hello and welcome to our website.

Title - Welcome to student room
Date - 06/05/11
Information - Hello and welcome to the student room. We are a online forum that allows previous and current students to ask questions. 
</code></pre>

<p>I need to parse this text file and save things like the title line, date line and the rest will be saved as information. I know how to read the file and save the full file as a string but I am stuck on getting the select information. </p>

<p><strong>CODE</strong></p>

<p>This is the code I have used to read the text file</p>

<pre><code>helloTxt.setText(readTxt());



}

private String readTxt() {

    InputStream inputStream = getResources().openRawResource(R.raw.pages);

    ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();

    int i;
    try {
        i = inputStream.read();
        while (i != -1) {
            byteArrayOutputStream.write(i);
            i = inputStream.read();
        }
        inputStream.close();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    String str = byteArrayOutputStream.toString();

    return str;

}
</code></pre>
