Search code examples
javabrainfuckesoteric-languages

Advanced Java console input


As a self-practice, I'm making a BF interpreter in Java that does I/O through the console. For the most part it's fine, however, as you might be aware, BF takes input one character at a time, including newlines. This means that as far as I know the standard console input libraries won't work, because they take in entire strings, and then ask for a return at the end. I want , to take in the next keystroke that fits into a char without printing it when it is typed. So when BF asks for input, and you type in a, it takes in the a but doesn't show it in the console unless the BF program outputs a itself later.

How can I do this?


Solution

  • I suggest using JLine http://jline.sourceforge.net

    The Terminal class has a disableEcho() method to do what you want.