title: How to get control characters from a console input string
body: <p>I have looked through the suggested "already answered" questions for this.  Mostly they want simply to discard such "non-printable" input.  I want to use it.</p>
  
  <p>I am getting a UTF8 <code>String</code> returned from keyboard input using </p>
  
  <pre><code>BufferedReader br = new BufferedReader( new InputStreamReader(System.in, 'UTF-8' ));
  String response = br.readLine();
  </code></pre>
  
  <p>and I am interested in identifying whether the user has input, for example, up-arrow or down-arrow as one of their keystrokes.</p>
  
  <p>Iterating through the <code>char</code>s in this <code>String</code> I find that down-arrow translates to (<code>int</code> value for <code>char</code>) 27, 91, 66, i.e. 3 <code>char</code>s.  The first value corresponds to <code>Escape</code>. It seems therefore that this is not a matter of identifying a single <code>Character</code> and finding out whether it is non-printable.</p>
  
  <p>Also I'm not clear why this control character can't be printed out as a single UTF8 character, but instead prints out as the 3 component parts of the UTF8 character: does this mean that when you iterate through a <code>String</code> you are in fact getting its contents byte-by-byte?</p>
  
  <p>I just wonder if there is any documented or clever way of doing this (finding and identifying control characters) in a given UTF8 String. Perhaps Apache Commons.  Or perhaps in Groovy (which I am in fact using, rather than Java)?</p>