I use huge data files, sometimes I only need to know the number of lines in these files, usually I open them up and read them line by line until I reach the end of the file<
With java-8, you can use streams:
try (Stream lines = Files.lines(path, Charset.defaultCharset())) { long numOfLines = lines.count(); ... }