I have a java program that sends some data over the network. I also capture all the keys pressed on the client and send them to the server therefore server maintains a buffer containing all the keys pressed on the client.
I need to create a file containing the final text produced by client. Take the following sequence as an example:
press j
press h
press BACKSPACE
press H
press e
press l
press HOME
press DEL
press END
press l
press o
Processing this sequence produces:
Hello
This is a simple example but notice that it can contain arrow keys as well.
Processing this buffer can be error prone and time consuming. I'd appreciate it if anyone could introduce a library that does these things or shows a simple way for doing it.
EDIT: I changed my question to ask a specific question instead of looking for a library.
I don't want to create a console parser and no need for history or tab completion. So my question is different from readline-like library in java.
Thanks.