Selecting an input file for Reader
I am trying to write a scanner, with the eventual aim of creating a parser to follow on from it. So I am trying to read a text file, look at each character one by one in order to decide what it is. My issue at the moment is how to allow to the user to select the file they wish to scan. Just a few questions:
1. Is the BufferedReader the correct reader to use?
2. If I am to use this, is it ok to simply limit the size of the buffer to one byte, will this ensure I am scanning one character at a time?
3. Can you ask a bufferedReader to read a variable? (which will be the filename of the text file that the user has asked for) i.e. Ask the user what file they want, store it as a variable called userFile and then have:
BufferedReader br = new BufferedReader(new InputStreamReader(userFile), 1);
Many thanks in advance for any help!