Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reading a File without line breaks using Buffered reader

I am reading a file with comma separated values which when split into an array will have 10 values for each line . I expected the file to have line breaks so that

line = bReader.readLine()

will give me each line. But my file doesnt have a line break. Instead after the first set of values there are lots of spaces(465 to be precise) and then the next line begins.

So my above code of readLine() is reading the entire file in one go as there are no lined breaks. Please suggest how best to efficiently tackle this scenario.

like image 630
Shahul Basha Avatar asked Aug 24 '26 13:08

Shahul Basha


1 Answers

One way is to replace String with 465 spaces in your text with new line character "\n" before iterating it for reading.

like image 113
Ninad Pingale Avatar answered Aug 26 '26 03:08

Ninad Pingale



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!