Although this is not difficult to do manually using BufferedReader and InputStreamReader , I would use Guava :
List<String> lines = Files.readLines(file, Charsets.UTF_8);
Then you can do whatever you want with these lines.
EDIT: Note that this will read the entire file into memory at a time. In most cases, this is really good - and this, of course, is easier than reading line by line, processing each line when you read it. If this is a huge file, you might have to do it just like TJ Crowder's Answer.
Jon Skeet Sep 14 2018-11-11T00: 00Z
source share