java - reading parts of a txt file -
this question has answer here:
i have text file following urls:
http://www.google.com.uy http://www.google.com.es http://www.google.com.nz
i need read second line of txt, second url showed there. i've been researching , didn't find need, because, although know have use bufferedreader
class, don't know how specify "line" want read.
this wrote far:
string fileread = "chlist\\gather.txt"; try { bufferedreader br = new bufferedreader(new filereader(fileread)); string gathertext = br.readline(); br.close(); } catch (ioexception ioe) {}
each call br.readline();
return line text file , move next line, second call give line want. simplest way write:
string fileread = "chlist\\gather.txt"; try { bufferedreader br = new bufferedreader(new filereader(fileread)); br.readline(); string gathertext = br.readline(); br.close(); } catch (ioexception ioe) {}
although should consider if file not contain 2 lines.
Comments
Post a Comment