APIdia Launch Partner
Top Description Fields Constructors Methods
jdk.internal.org.jline.keymap

public Class BindingReader

extends Object
Class Inheritance
Imports
java.io.IOError, .IOException, java.util.ArrayDeque, .Deque, jdk.internal.org.jline.reader.EndOfFileException, jdk.internal.org.jline.utils.ClosedException, .NonBlockingReader

The BindingReader will transform incoming chars into key bindings
Author
Guillaume Nodet

Field Summary

Modifier and TypeField and Description
protected String
protected final StringBuilder
protected final Deque<Integer>
protected final NonBlockingReader

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
public String
public int
peekCharacter(long timeout)

public <
the type of bindings to be read
T
>
T

Returns:

the decoded binding or null if the end of stream has been reached
readBinding
(KeyMap<T>
the KeyMap to use for decoding the input stream
keys
)

Read from the input stream and decode an operation from the key map.

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

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

public int

Returns:

the character, or -1 if an EOF is received.
readCharacter
()

Read a codepoint from the terminal.

public int
public String
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

lastBindingback to summary
protected String lastBinding
opBufferback to summary
protected final StringBuilder opBuffer
pushBackCharback to summary
protected final Deque<Integer> pushBackChar
readerback to summary
protected final NonBlockingReader reader

Constructor Detail

BindingReaderback to summary
public BindingReader(NonBlockingReader reader)

Method Detail

getCurrentBufferback to summary
public String getCurrentBuffer()
getLastBindingback to summary
public String getLastBinding()
peekCharacterback to summary
public int peekCharacter(long timeout)
readBindingback to summary
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.

Parameters
<T>
the type of bindings to be read
keys:KeyMap<T>

the KeyMap to use for decoding the input stream

Returns:T

the decoded binding or null if the end of stream has been reached

readBindingback to summary
public <T> T readBinding(KeyMap<T> keys, KeyMap<T> local)
readBindingback to summary
public <T> T readBinding(KeyMap<T> keys, KeyMap<T> local, boolean block)
readCharacterback to summary
public int readCharacter()

Read a codepoint from the terminal.

Returns:int

the character, or -1 if an EOF is received.

readCharacterBufferedback to summary
public int readCharacterBuffered()
readStringUntilback to summary
public String readStringUntil(String sequence)
runMacroback to summary
public void runMacro(String macro)