Read text file with Scanner in Java


Reading file with encoding.
Snipet:

File file = new File("filePath.txt");
Scanner scanner = new Scanner(new FileInputStream(file), "UTF-8");
try
{
	while (scanner.hasNextLine())
		System.out.println(scanner.nextLine());
}
finally
{
	scanner.close();
}