Class CharReader

  • Direct Known Subclasses:
    Terminal

    public class CharReader
    extends java.lang.Object
    A keystroke char reader. returns a Char object at a time related to the single keystroke the user typed.
    • Constructor Summary

      Constructors 
      Constructor Description
      CharReader​(java.io.InputStream in)  
      CharReader​(java.io.Reader in)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Char read()
      Read the next char.
      Char readIfAvailable()
      Read a single char if ready (something is available in the input stream), otherwise return null.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CharReader

        public CharReader​(java.io.InputStream in)
      • CharReader

        public CharReader​(java.io.Reader in)
    • Method Detail

      • readIfAvailable

        public Char readIfAvailable()
                             throws java.io.IOException
        Read a single char if ready (something is available in the input stream), otherwise return null.
        Returns:
        The read char or null of not ready.
        Throws:
        java.io.IOException - If failed to read from input.
      • read

        public Char read()
                  throws java.io.IOException
        Read the next char.
        Returns:
        The next char, or null of input stream is closed.
        Throws:
        java.io.IOException - If unable to read a char.