public class BindingReader extends Object
Modifier and Type | Field | Description |
---|---|---|
protected String |
lastBinding |
|
protected StringBuilder |
opBuffer |
|
protected Deque<Integer> |
pushBackChar |
|
protected NonBlockingReader |
reader |
Constructor | Description |
---|---|
BindingReader(NonBlockingReader reader) |
Modifier and Type | Method | Description |
---|---|---|
String |
getCurrentBuffer() |
|
String |
getLastBinding() |
|
int |
peekCharacter(long timeout) |
|
<T> T |
readBinding(KeyMap<T> keys) |
Read from the input stream and decode an operation from the key map.
|
<T> T |
readBinding(KeyMap<T> keys,
KeyMap<T> local) |
|
<T> T |
readBinding(KeyMap<T> keys,
KeyMap<T> local,
boolean block) |
|
int |
readCharacter() |
Read a codepoint from the terminal.
|
int |
readCharacterBuffered() |
|
String |
readStringUntil(String sequence) |
|
void |
runMacro(String macro) |
protected final NonBlockingReader reader
protected final StringBuilder opBuffer
protected String lastBinding
public BindingReader(NonBlockingReader reader)
public <T> T readBinding(KeyMap<T> keys)
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.T
- the type of bindings to be readkeys
- the KeyMap to use for decoding the input streamnull
if the end of
stream has been reachedpublic int readCharacter()
public int readCharacterBuffered()
public int peekCharacter(long timeout)
public void runMacro(String macro)
public String getCurrentBuffer()
public String getLastBinding()
Copyright © 2020. All rights reserved.