There are many ways you can do this, as ASCII is a text file these are the following ways you can use -
The most common method to read a text file in Java is BufferedReader. It is really efficient for reading large text files.The buffer size may be specified, or the default size may be used. Usually, the default value is large enough for most files.
BufferedReader in = new BufferedReader(Reader in, int size);
This is another method used for large files.It is a simple text scanner and can parse primitive types and strings using regular expressions.
Scanner in = new Scanner( Reader in );
In JDK 7, nio package was introduced which can be used to store a whole plain text file into a List<String> using Files.readAllLines().This method closes the file when all bytes have been read or there is an I/O error or any other runtime exception is thrown.
It cannot be used for large files as this method loads the whole file in memory all at once.
List<String> lines = Files.readAllLines(filePath);
For Java 8, there is a simple one liner to store the contents of a text file to List<String>.
List<String> lines = Files.lines(path).collect(Collectors.toList());