Class BindingReader

java.lang.Object
org.jline.keymap.BindingReader

public class BindingReader extends Object
The BindingReader will transform incoming chars into key bindings
Author:
Guillaume Nodet
  • Field Details

  • Constructor Details

  • Method Details

    • readBinding

      public <T> T readBinding(KeyMap<T> keys)
      Read from the input stream and decode an operation from the key map. The input stream will be read character by character until a matching binding can be found. Characters that can't possibly be matched to any binding will be send with the KeyMap.getNomatch() binding. Unicode (>= 128) characters will be matched to KeyMap.getUnicode(). If the current key sequence is ambiguous, i.e. the sequence is bound but it's also a prefix to other sequences, then the KeyMap.getAmbiguousTimeout() timeout will be used to wait for another incoming character. If a character comes, the disambiguation will be done. If the timeout elapses and no character came in, or if the timeout is <= 0, the current bound operation will be returned.
      Type Parameters:
      T - the type of bindings to be read
      Parameters:
      keys - the KeyMap to use for decoding the input stream
      Returns:
      the decoded binding or null if the end of stream has been reached
    • readBinding

      public <T> T readBinding(KeyMap<T> keys, KeyMap<T> local)
    • readBinding

      public <T> T readBinding(KeyMap<T> keys, KeyMap<T> local, boolean block)
    • readStringUntil

      public String readStringUntil(String sequence)
    • readCharacter

      public int readCharacter()
      Read a codepoint from the terminal.
      Returns:
      the character, or -1 if an EOF is received.
    • readCharacterBuffered

      public int readCharacterBuffered()
    • peekCharacter

      public int peekCharacter(long timeout)
    • runMacro

      public void runMacro(String macro)
    • getCurrentBuffer

      public String getCurrentBuffer()
    • getLastBinding

      public String getLastBinding()