title: How do I read input character-by-character in Java?
body: <p>I am used to the c-style <code>getchar()</code>, but it seems like there is nothing comparable for java. I am building a lexical analyzer, and I need to read in the input character by character.</p>
  
  <p>I know I can use the scanner to scan in a token or line and parse through the token char-by-char, but that seems unwieldy for strings spanning multiple lines. Is there a way to just get the next character from the input buffer in Java, or should I just plug away with the Scanner class?</p>
  
  <p>The input is a file, not the keyboard.</p>