use of com.jn.agileway.ssh.client.utils.PTYMode in project agileway by fangjinuo.
the class SshjSessionedChannel method pty.
@Override
public void pty(String term, int termWidthCharacters, int termHeightCharacters, int termWidthPixels, int termHeightPixels, Map<PTYMode, Integer> terminalModes) throws SshException {
final Map<net.schmizz.sshj.connection.channel.direct.PTYMode, Integer> terminalModeMap = new HashMap<net.schmizz.sshj.connection.channel.direct.PTYMode, Integer>();
Collects.forEach(terminalModes, new Consumer2<PTYMode, Integer>() {
@Override
public void accept(PTYMode ptyMode, Integer value) {
String operateName = ptyMode.name();
net.schmizz.sshj.connection.channel.direct.PTYMode mode = Enums.ofName(net.schmizz.sshj.connection.channel.direct.PTYMode.class, operateName);
if (mode != null) {
terminalModeMap.put(mode, value);
}
}
});
try {
this.session.allocatePTY(term, termWidthCharacters, termHeightCharacters, termWidthPixels, termHeightPixels, terminalModeMap);
} catch (Throwable ex) {
throw new SshException(ex);
}
}
use of com.jn.agileway.ssh.client.utils.PTYMode in project agileway by fangjinuo.
the class SynergySessionedChannel method pty.
@Override
public void pty(String term, int termWidthCharacters, int termHeightCharacters, int termWidthPixels, int termHeightPixels, Map<PTYMode, Integer> terminalModes) throws SshException {
final PseudoTerminalModes modes = new PseudoTerminalModes();
if (terminalModes != null) {
Collects.forEach(terminalModes, new Consumer2<PTYMode, Integer>() {
@Override
public void accept(PTYMode ptyMode, Integer value) {
try {
modes.setTerminalMode(ptyMode.getOpcodeInt(), value);
} catch (Throwable ex) {
// ignore it
}
}
});
}
this.channel.allocatePseudoTerminal(term, termWidthCharacters, termHeightCharacters, termWidthPixels, termHeightPixels, modes);
}
Aggregations