Hi,

It means that you have your own command, right ?

Do you use regular command arguments or is it a custom Action using
directly the session ?

Regards
JB

On 26/04/2019 14:07, Ravi wrote:
> From PUTTY console, I am entering y or n and reading from my application
> using karaf 4.2.2
> 
> Reading next byte data, so that, i need to enter two times nn or yy, if
> enter name with multiple characters, it is not reading all the characters.
> (char)session.getKeyboard().read(); 
> 
> Is there any solution to resolve inconsistency of reading characters.
> 
> CommandSession session = it is a method parameter.
> 
> session.getConsole().printf("Do you wish to continue? (y/n):");
> session.getConsole().flush();
> boolean result = getYesNoSelection(session);
> 
> public boolean getYesNoSelection(CommandSession session) throws IOException
> {
>    char ch ='\0';
>    boolean flag = true;
>    while (true) {
>        session.getConsole().flush();
>        ch = (char)session.getKeyboard().read();
>        if (ch == 'Y' || ch == 'y') {
>            flag = true;
>            session.getConsole().print('y');
>            break;
>        }
>        if (ch == 'N' || ch == 'n') {
>            flag = false;
>            session.getConsole().print('n');
>            break;
>        }
>    }
>    session.getConsole().flush();
>    session.getConsole().println();
>    session.getConsole().flush();
>    return flag;
> }
> 
> 
> 
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-Dev-f930721.html
> 

Reply via email to