I am reading the file line by line, and I am trying to make sure that if I get to the line that matches my specific parameters (in my case, if it starts with a specific word), I can overwrite this line.
My current code is:
try { FileInputStream fis = new FileInputStream(myFile); DataInputStream in = new DataInputStream(fis); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String line; while ((line = br.readLine()) != null) { System.out.println(line); if (line.startsWith("word")) {
... where myFile is a File object.
As always, any help, examples or suggestions are greatly appreciated.
Thanks!
iphonedev7
source share