Re: Slightly OT: non-buffered stdin in Java

From: Dr. Nikolaus Klepp <dr.klepp_at_gmx.at>
Date: Thu, 08 Jun 2023 18:39:36 UTC
Anno domini 2023 Thu, 8 Jun 14:01:19 -0400
 Aryeh Friedman scripsit:
> Under Java stdin (System.in) is a buffered stream not sent to the
> application until return is pressed.  But, Java can read from
> files/sockets and other generic InputStreams unbuffered.   So I was
> wondering if there is a command that will make stdin go to a file so
> that Java can open that file and read it unbuffered?
>
> I know I can do something like cat ->file but that makes it hard to
> sync stdout and stderr (both are unbuffered in Java) with the file
> version of stdin
>

"stdbuf" might be what you look for:

https://man.freebsd.org/cgi/man.cgi?query=stdbuf

Nik

--
Please do not email me anything that you are not comfortable also sharing with the NSA, CIA ...