1

I have a wordlist saved in the assets folder in my app and i want to be able to read each word in, check it against a string and then repeat for how many words there are in the word list.

To do this though i need to be able to use a stream reader that has a readLine() method.

For reading from assets previously i have been using:

AssetManager am = getAssets();
InputStream in = am.open("wordlist.txt");
int data;
while((data=in.read())!=-1){
    System.out.println((char)data)
}in.close();

But this doesnt read in lines. I could check if each "data" is a newline char but is there a better way to do this?

If I replace InputStream I need to find an alternative that works with AssetManager Just so you know the WordList (50,000 words) is quite long so the algorithm needs to be quite quick

Eduardo
  • 6,900
  • 17
  • 77
  • 121

0 Answers0