the bufreader for reading file io , reads one line at a time ? , or whatever comes in its 4kb buffer and
what happens if a line is bigger than 4kb
BufReader
reads in raw bytes, it's not text line oriented on its own. Its purpose is to avoid a slew of read syscalls if you're "sipping" from the underlying (unbuffered) I/O source (e.g. reading just a few bytes at a time). To get text lines out of it, you'd use the Lines
iterator, which sits on top of the BufReader
and gives it a String
to read into (so another buffer on top, if you will): mod.rs - source
1 Like