Here you can find the source of writeLineS(String filePath, String msg, int line)
public static void writeLineS(String filePath, String msg, 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 { /**// ww w.j a va2s. c o m * Write data to a specific line of a text file. <br> * Will override the old data. */ public static void writeLineS(String filePath, String msg, int line) throws IOException { File f = new File(filePath); List<String> lines = Files.readAllLines(f.toPath()); lines.set(line - 1, msg); Files.write(f.toPath(), lines); } }