title: Read text file as resource
body: <p>I am trying to read a file "words.txt" from a resource. It is a very simple, but large (2 MB), text file that I want to read line by line. I have put the file into /res/raw/words.txt, and try to open it with the following code:</p>
  
  <pre><code>    try 
      {   
          BufferedReader in = 
              new BufferedReader(
              new InputStreamReader(getResources().openRawResource(R.raw.words)));
          String line=in.readLine();
          T.append(line); T.append("\n");
          in.close();
      }
      catch (Exception e) { T.append(e.toString()); }
  </code></pre>
  
  <p>However, I get a java.io.IOException. This is not a "resource not found" exception, so the resource is opened correctly, but the readLine() produces the error.</p>
  
  <p>I tried using the InputStream itself, with the result that read() produces -1, which stands for EOF, as if the file was empty.</p>
  
  <p>Any help for me?</p>
  
  <hr>
  
  <p>Till now I am still splitting up long files. So this is the best answer I can give. Anyone a better idea?</p>