Here you can find the source of readLineS(String filePath, int line)
public static String readLineS(String filePath, int line) throws IOException
//package com.java2s; //License from project: LGPL import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.util.List; public class Main { /**/*w w w. j a va 2 s . co m*/ * Read the context of a specified line in a text file. */ public static String readLineS(String filePath, int line) throws IOException { File f = new File(filePath); List<String> lines = Files.readAllLines(f.toPath()); return lines.get(line - 1); } }