Is there an easy way to read a single char from the console as the user is typing it in Java? Is it possible? I\'ve tried with these methods but they all wait for the user t
I have written a Java class RawConsoleInput that uses JNA to call operating system functions of Windows and Unix/Linux.
_kbhit() and _getwch() from msvcrt.dll.tcsetattr() to switch the console to non-canonical mode, System.in.available() to check whether data is available and System.in.read() to read bytes from the console. A CharsetDecoder is used to convert bytes to characters.It supports non-blocking input and mixing raw mode and normal line mode input.