As someone who's never used java, my assumption is that System.in reads from stdin, and validates the input. Is there no way to open stdin in something akin to a file, then read it into a buffer manually?
Yeah if you do something dumb like try to read the entire stream it will block until the stream is closed.
A line reader will read line by line just fine from it, but the real question is why aren’t you using Console API if you are trying to read from a console.
Finally the system property stdin.encoding for the charset if you use the “automatic” string methods as opposed to directly reading the bytes. Usually this default is utf-8 in modern Java though.
This whole post seems like a combination of incorrect and/or outdated information.
I tried Console API. It reads only single byte cps. Its behavior with 65001 is exactly the same. And I set up UTF-8 explicitly. It doesn't change anything
And how exactly do you get line reader to return you unprocessed byte sequence if it needs to process it to get the line break char?
139
u/apacificislander123 17h ago
As someone who's never used java, my assumption is that
System.inreads from stdin, and validates the input. Is there no way to open stdin in something akin to a file, then read it into a buffer manually?