com.jcraft.jsch.Channel.setOutputStream()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(250)

本文整理了Java中com.jcraft.jsch.Channel.setOutputStream()方法的一些代码示例,展示了Channel.setOutputStream()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Channel.setOutputStream()方法的具体详情如下:
包路径:com.jcraft.jsch.Channel
类名称:Channel
方法名:setOutputStream

Channel.setOutputStream介绍

[英]Sets the OutputStream for this channel. All data arriving in SSH_MSG_CHANNEL_DATA messages from the remote side will be written to this OutputStream. This method should be called before #connect. The stream will be closed on #disconnect.
[中]设置此通道的输出流。从远程端到达SSH_MSG_CHANNEL_数据消息的所有数据都将写入此输出流。应在连接之前调用此方法。断开连接时,该流将关闭。

代码示例

代码示例来源:origin: jphp-group/jphp

@Signature
  public void setOutputStream(Environment env, @Nullable Stream stream, boolean dontClose) {
    getWrappedObject().setOutputStream(stream == null ? null : Stream.getOutputStream(env, stream), dontClose);
  }
}

代码示例来源:origin: net.sf.jnrpe/jnrpe-plugins

@Override
public final Collection<Metric> gatherMetrics(final ICommandLine cl) throws MetricGatheringException {
  List<Metric> metrics = new ArrayList<Metric>();
  Session session = null;
  try {
    session = SshUtils.getSession(cl);
    Channel channel = session.openChannel("shell");
    channel.setInputStream(System.in);
    channel.setOutputStream(System.out);
    channel.connect();
    metrics.add(new Metric("connected", "", new BigDecimal(1), null, null));
    channel.disconnect();
    session.disconnect();
  } catch (Exception e) {
    
    String message = e.getMessage();
    
    metrics.add(new Metric("connected", message, new BigDecimal(0), null, null));
    LOG.debug(getContext(), message, e);
  }
  return metrics;
}

代码示例来源:origin: com.googlecode.openbox/ssh

session = createSession(output);
Channel channel = session.openChannel("sftp");
channel.setOutputStream(output, true);
channel.setExtOutputStream(output, true);
channel.connect();

代码示例来源:origin: io.openscore.content/score-ssh

channel.setInputStream(in);
OutputStream out = new ByteArrayOutputStream();
channel.setOutputStream(out);
OutputStream err = new ByteArrayOutputStream();
channel.setExtOutputStream(err);

代码示例来源:origin: io.cloudslang.content/score-ssh

channel.setInputStream(in);
OutputStream out = new ByteArrayOutputStream();
channel.setOutputStream(out);
OutputStream err = new ByteArrayOutputStream();
channel.setExtOutputStream(err);

相关文章