Home > Mobile >  is there a function in kotlin that reads a file Char by char?
is there a function in kotlin that reads a file Char by char?

Time:11-10

Trying to read a file char by char in kotlin , i know you can read line by line in buffered reader. But to prevent huge chunks of data in ram if a file is all in on line i want to read char by char

CodePudding user response:

You can always just call .read() on a BufferedReader. (It returns an int so it can return -1 if there's nothing, but otherwise you can convert the result to a char.)

  • Related