I would like to use a BufferedReader with a kind of readLine() (or similar) that can return an echo for every keystroke pressed.
It's for a remote terminal. Other way to ask it is how is implemented a console in java.
This is what came to mind but is too ugly. Is there any known library that implement something like this?
while(condition) {
nByteRead = in.read(buffer);
if (nByteRead != -1) {
// ECHO
out.write(buffer, 0, bytes_read);
// read bytes till NEW_LINE...
// etc...!
}
}
Of course I could encapsulate this behaviour in some thread and go on with a library for this, I just wonder if there is some wheel already invented.
Thanks for any hint!