Interface InputProvider

All Known Subinterfaces:
ExtendedTerminal, IOSafeExtendedTerminal, IOSafeTerminal, Screen, Terminal, VirtualTerminal
All Known Implementing Classes:
AbstractScreen, AbstractTerminal, ANSITerminal, AWTTerminal, AWTTerminalFrame, AWTTerminalImplementation, CygwinTerminal, DefaultVirtualTerminal, GraphicalTerminalImplementation, IOSafeTerminalAdapter, IOSafeTerminalAdapter.Extended, ScrollingAWTTerminal, ScrollingSwingTerminal, StreamBasedTerminal, SwingTerminal, SwingTerminalFrame, SwingTerminalImplementation, TelnetTerminal, TerminalScreen, UnixLikeTerminal, UnixLikeTTYTerminal, UnixTerminal, VirtualScreen

public interface InputProvider
Objects implementing this interface can read character streams and transform them into Key objects which can be read in a FIFO manner.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the next Key off the input queue or null if there is no more input events available.
    Returns the next Key off the input queue or blocks until one is available.
  • Method Details

    • pollInput

      KeyStroke pollInput() throws IOException
      Returns the next Key off the input queue or null if there is no more input events available. Note, this method call is not blocking, it returns null immediately if there is nothing on the input stream.
      Returns:
      Key object which represents a keystroke coming in through the input stream
      Throws:
      IOException - Propagated error if the underlying stream gave errors
    • readInput

      KeyStroke readInput() throws IOException
      Returns the next Key off the input queue or blocks until one is available. NOTE: In previous versions of Lanterna, this method was not blocking. From lanterna 3, it is blocking and you can call pollInput() for the non-blocking version.
      Returns:
      Key object which represents a keystroke coming in through the input stream
      Throws:
      IOException - Propagated error if the underlying stream gave errors