Java for Testers #37 - How to Read Data from CSV and Text File in Java

preview_player
Показать описание
In this Java for Testers tutorial we will learn how to Read Data from CSV and Text File in Java. Java library comes with File, FileReader and BufferedReader classes which can be utilized to read data from any CSV or text file.

Help me in spreading the knowledge, please hit LIKE, SHARE and SUBSCRIBE for latest tutorials. More tutorial playlists below:

🔶 ENROL IN MANY FREE TRAININGS ON RCV ACADEMY PORTAL 🔶

🔶 FOLLOW US ON TWITTER 🔶

🔶 LIKE US ON FACEBOOK 🔶

🔶 OUR TUTORIAL WEBSITES 🔶

🔶 GET MY TRAININGS ON UDEMY 🔶

#JavaForTesters #JavaForTestersTutorial #JavaBeginnersTutorial #JavaForSelenium #JavaForSeleniumTesters #TestAutomation #SeleniumWebDriverJava #RcvAcademy #SoftwareTestingMentor
Рекомендации по теме
Комментарии
Автор

Print all lines in the file:
File f = new
FileReader fr = new FileReader(f);
BufferedReader br = new BufferedReader(fr);
// 1).find out file's line #: Files.lines(path, StandardCharsets.UTF_8)
long lines;
try (Stream<String> stream = Files.lines(f.toPath(), StandardCharsets.UTF_8)) {
lines = stream.count();
}
System.out.println("Line # "+lines);
// 2).Print out all lines:
int i=0;
while(i<lines)
{


}
System.out.println("Read successfully");
br.close();

liningca
Автор

without using flush() method, the contents of the buffer are not getting written to file. is it mandatory to use flush()

swapnabhaskaruni
Автор

How to verify particular cell in the text file for example [1][3] first row third column?

amitapuranik