https://kotlinlang.org logo
Title
e

Elizeu Silva dos Santos

06/23/2022, 11:43 AM
I have a huge file to read, more than 5GB. I need to do some transformation over each line, convert into my data object and than persist.
File.forEachLine
is a good choice for that?
j

Joffrey

06/23/2022, 12:13 PM
The function is correct, but I'd recommend using
Path.forEachLine
instead. Manipulating
Path
is usually preferred over
File
in new code
Note that Kotlin provides lots of useful extensions on
Path
that make it much more convenient to use than Java's
Files.doSomething(Path)
e

Elizeu Silva dos Santos

06/23/2022, 1:35 PM
nice thanks