Logo Search packages:      
Sourcecode: jline version File versions  Download package

StringBuffer jline::ConsoleReader::getPrintableCharacters ( char  ch  )  [inline, package]

Return the number of characters that will be printed when the specified character is echoed to the screen. Adapted from cat by Torbjorn Granlund, as repeated in stty by David MacKenzie.

Definition at line 445 of file ConsoleReader.java.

      {
            StringBuffer sbuff = new StringBuffer ();
            if (ch >= 32)
            {
                  if (ch < 127)
                  {
                        sbuff.append (ch);
                  }
                  else if (ch == 127)
                  {
                        sbuff.append ('^');
                        sbuff.append ('?');
                  }
                  else
                  {
                        sbuff.append ('M');
                        sbuff.append ('-');
                        if (ch >= 128 + 32)
                        {
                              if (ch < 128 + 127)
                              {
                                    sbuff.append ((char)(ch - 128));
                              }
                              else
                              {
                                    sbuff.append ('^');
                                    sbuff.append ('?');
                              }
                        }
                        else
                        {
                              sbuff.append ('^');
                              sbuff.append ((char)(ch - 128 + 64));
                        }
                  }
            }
            else
            {
                  sbuff.append ('^');
                  sbuff.append ((char)(ch + 64));
            }

            return sbuff;
      }


Generated by  Doxygen 1.6.0   Back to index