本文整理了Java中org.jline.terminal.Terminal.setAttributes()
方法的一些代码示例,展示了Terminal.setAttributes()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Terminal.setAttributes()
方法的具体详情如下:
包路径:org.jline.terminal.Terminal
类名称:Terminal
方法名:setAttributes
暂无
代码示例来源:origin: apache/flink
private void restoreTerminal(Tuple2<Attributes, Map<Signal, SignalHandler>> prev) {
final Terminal terminal = client.getTerminal();
terminal.setAttributes(prev.f0);
prev.f1.forEach(terminal::handle);
}
代码示例来源:origin: apache/flink
private Tuple2<Attributes, Map<Signal, SignalHandler>> prepareTerminal() {
final Terminal terminal = client.getTerminal();
final Attributes prevAttributes = terminal.getAttributes();
// adopted from org.jline.builtins.Nano
// see also https://en.wikibooks.org/wiki/Serial_Programming/termios#Basic_Configuration_of_a_Serial_Interface
// no line processing
// canonical mode off, echo off, echo newline off, extended input processing off
Attributes newAttr = new Attributes(prevAttributes);
newAttr.setLocalFlags(EnumSet.of(LocalFlag.ICANON, LocalFlag.ECHO, LocalFlag.IEXTEN), false);
// turn off input processing
newAttr.setInputFlags(EnumSet.of(Attributes.InputFlag.IXON, Attributes.InputFlag.ICRNL, Attributes.InputFlag.INLCR), false);
// one input byte is enough to return from read, inter-character timer off
newAttr.setControlChar(Attributes.ControlChar.VMIN, 1);
newAttr.setControlChar(Attributes.ControlChar.VTIME, 0);
newAttr.setControlChar(Attributes.ControlChar.VINTR, 0);
terminal.setAttributes(newAttr);
final Map<Signal, SignalHandler> prevSignals = new HashMap<>();
prevSignals.put(Signal.WINCH, terminal.handle(Signal.WINCH, this::handleSignal));
prevSignals.put(Signal.INT, terminal.handle(Signal.INT, this::handleSignal));
prevSignals.put(Signal.QUIT, terminal.handle(Signal.QUIT, this::handleSignal));
return Tuple2.of(prevAttributes, prevSignals);
}
代码示例来源:origin: apache/karaf
@Override
public void setAttributes(Attributes attr) {
terminal.setAttributes(attr);
}
代码示例来源:origin: org.apache.karaf.shell/org.apache.karaf.shell.core
@Override
public void setAttributes(Attributes attr) {
terminal.setAttributes(attr);
}
代码示例来源:origin: com.github.fonimus/ssh-shell-starter
@Override
public void setAttributes(Attributes attributes) {
delegate().setAttributes(attributes);
}
代码示例来源:origin: com.github.fonimus/spring-boot-ssh-shell-starter
@Override
public void setAttributes(Attributes attributes) {
delegate().setAttributes(attributes);
}
代码示例来源:origin: jpos/jPOS
private Terminal buildTerminal (InputStream in, OutputStream out) throws IOException {
TerminalBuilder builder = TerminalBuilder.builder();
builder.streams(in,out).system(System.in == in);
Terminal t = builder.build();
Attributes attr = t.getAttributes();
attr.getOutputFlags().addAll(
EnumSet.of(Attributes.OutputFlag.ONLCR, Attributes.OutputFlag.OPOST)
);
t.setAttributes(attr);
return t;
}
代码示例来源:origin: apache/karaf
@Override
public Object execute() throws Exception {
if (arguments == null || arguments.length() == 0) {
System.err.println("Argument expected");
} else {
WatchTask watchTask = new WatchTask();
executorService.scheduleAtFixedRate(watchTask, 0, interval, TimeUnit.SECONDS);
try {
Terminal terminal = (Terminal) session.get(".jline.terminal");
Terminal.SignalHandler prev = terminal.handle(Terminal.Signal.INT, this::abort);
Attributes attr = terminal.enterRawMode();
try {
reading = Thread.currentThread();
while (terminal.reader().read(1) == NonBlockingReader.READ_EXPIRED);
} finally {
reading = null;
terminal.setAttributes(attr);
terminal.handle(Terminal.Signal.INT, prev);
}
} catch (InterruptedIOException e) {
// Ignore
} finally {
abort = true;
executorService.shutdownNow();
}
}
return null;
}
代码示例来源:origin: org.apache.karaf.shell/org.apache.karaf.shell.commands
@Override
public Object execute() throws Exception {
if (arguments == null || arguments.length() == 0) {
System.err.println("Argument expected");
} else {
WatchTask watchTask = new WatchTask();
executorService.scheduleAtFixedRate(watchTask, 0, interval, TimeUnit.SECONDS);
try {
Terminal terminal = (Terminal) session.get(".jline.terminal");
Terminal.SignalHandler prev = terminal.handle(Terminal.Signal.INT, this::abort);
Attributes attr = terminal.enterRawMode();
try {
reading = Thread.currentThread();
while (terminal.reader().read(1) == NonBlockingReader.READ_EXPIRED);
} finally {
reading = null;
terminal.setAttributes(attr);
terminal.handle(Terminal.Signal.INT, prev);
}
} catch (InterruptedIOException e) {
// Ignore
} finally {
abort = true;
executorService.shutdownNow();
}
}
return null;
}
代码示例来源:origin: apache/felix
Attributes attr = terminal.enterRawMode();
terminal.reader().read();
terminal.setAttributes(attr);
} finally {
executorService.shutdownNow();
代码示例来源:origin: org.jline/jline-builtins
terminal.setAttributes(attr);
if (prevHandler != null) {
terminal.handle(Terminal.Signal.WINCH, prevHandler);
代码示例来源:origin: org.jline/jline
terminal.setAttributes(attr);
if (prevHandler != null) {
terminal.handle(Terminal.Signal.WINCH, prevHandler);
代码示例来源:origin: apache/samza
private void restoreTerminal(TerminalStatus status) {
// Signal handlers
terminal.handle(Terminal.Signal.INT, status.handler_INT);
terminal.handle(Terminal.Signal.QUIT, status.handler_QUIT);
terminal.handle(Terminal.Signal.TSTP, status.handler_TSTP);
terminal.handle(Terminal.Signal.CONT, status.handler_CONT);
terminal.handle(Terminal.Signal.WINCH, status.handler_WINCH);
// Attributes
terminal.setAttributes(status.attributes);
// Capability
terminal.puts(InfoCmp.Capability.exit_ca_mode);
terminal.puts(InfoCmp.Capability.cursor_visible);
}
代码示例来源:origin: jpos/jPOS-EE
term.setAttributes(termAttrs);
代码示例来源:origin: com.github.fonimus/spring-boot-ssh-shell-starter
terminal.setAttributes(attr);
代码示例来源:origin: org.jline/jline-builtins
terminal.puts(Capability.exit_ca_mode);
terminal.flush();
terminal.setAttributes(attributes);
terminal.handle(Signal.WINCH, prevWinchHandler);
terminal.handle(Signal.INT, prevIntHandler);
代码示例来源:origin: org.jline/jline
terminal.puts(Capability.exit_ca_mode);
terminal.flush();
terminal.setAttributes(attributes);
terminal.handle(Signal.WINCH, prevWinchHandler);
terminal.handle(Signal.INT, prevIntHandler);
代码示例来源:origin: apache/samza
terminal.setAttributes(newAttributes);
代码示例来源:origin: org.jline/jline
terminal.setAttributes(attr);
terminal.setAttributes(originalAttributes);
代码示例来源:origin: org.jline/jline
newAttr.setControlChar(ControlChar.VTIME, 0);
newAttr.setControlChar(ControlChar.VINTR, 0);
terminal.setAttributes(newAttr);
terminal.puts(Capability.enter_ca_mode);
terminal.puts(Capability.keypad_xmit);
terminal.puts(Capability.keypad_local);
terminal.flush();
terminal.setAttributes(attributes);
terminal.handle(Signal.WINCH, prevHandler);
内容来源于网络,如有侵权,请联系作者删除!