Beware that what C calls a char
, Java calls a byte
.
You want to open an InputStream
on your file (using Files.newInputStream()
). Then, you will .read()
from the InputStream
. That is the closest thing to C's fgetc()
.
That is for binary data. If you want to read text instead you'll have to use a Reader
.
You may want to have a look here for the full story, because it isn't obvious at all.