当前位置: 首页>>代码示例>>Java>>正文


Java Packets.SSH_EXTENDED_DATA_STDERR属性代码示例

本文整理汇总了Java中com.trilead.ssh2.packets.Packets.SSH_EXTENDED_DATA_STDERR属性的典型用法代码示例。如果您正苦于以下问题:Java Packets.SSH_EXTENDED_DATA_STDERR属性的具体用法?Java Packets.SSH_EXTENDED_DATA_STDERR怎么用?Java Packets.SSH_EXTENDED_DATA_STDERR使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.trilead.ssh2.packets.Packets的用法示例。


在下文中一共展示了Packets.SSH_EXTENDED_DATA_STDERR属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: msgChannelExtendedData

public void msgChannelExtendedData(byte[] msg, int msglen) throws IOException
{
	if (msglen <= 13)
		throw new IOException("SSH_MSG_CHANNEL_EXTENDED_DATA message has wrong size (" + msglen + ")");

	int id = ((msg[1] & 0xff) << 24) | ((msg[2] & 0xff) << 16) | ((msg[3] & 0xff) << 8) | (msg[4] & 0xff);
	int dataType = ((msg[5] & 0xff) << 24) | ((msg[6] & 0xff) << 16) | ((msg[7] & 0xff) << 8) | (msg[8] & 0xff);
	int len = ((msg[9] & 0xff) << 24) | ((msg[10] & 0xff) << 16) | ((msg[11] & 0xff) << 8) | (msg[12] & 0xff);

	Channel c = getChannel(id);

	if (c == null)
		throw new IOException("Unexpected SSH_MSG_CHANNEL_EXTENDED_DATA message for non-existent channel " + id);

	if (dataType != Packets.SSH_EXTENDED_DATA_STDERR)
		throw new IOException("SSH_MSG_CHANNEL_EXTENDED_DATA message has unknown type (" + dataType + ")");

	if (len != (msglen - 13))
		throw new IOException("SSH_MSG_CHANNEL_EXTENDED_DATA message has wrong len (calculated " + (msglen - 13)
				+ ", got " + len + ")");

	if (log.isEnabled())
		log.log(80, "Got SSH_MSG_CHANNEL_EXTENDED_DATA (channel " + id + ", " + len + ")");

	synchronized (c)
	{
		if (c.state == Channel.STATE_CLOSED)
			return; // ignore

		if (c.state != Channel.STATE_OPEN)
			throw new IOException("Got SSH_MSG_CHANNEL_EXTENDED_DATA, but channel is not in correct state ("
					+ c.state + ")");

		if (c.localWindow < len)
			throw new IOException("Remote sent too much data, does not fit into window.");

		c.localWindow -= len;

		System.arraycopy(msg, 13, c.stderrBuffer, c.stderrWritepos, len);
		c.stderrWritepos += len;

		c.notifyAll();
	}
}
 
开发者ID:dragonlinux,项目名称:connectbot,代码行数:44,代码来源:ChannelManager.java

示例2: msgChannelExtendedData

public void msgChannelExtendedData(byte[] msg, int msglen)
		throws IOException {
	if (msglen <= 13)
		throw new IOException(
				"SSH_MSG_CHANNEL_EXTENDED_DATA message has wrong size ("
						+ msglen + ")");

	int id = ((msg[1] & 0xff) << 24) | ((msg[2] & 0xff) << 16)
			| ((msg[3] & 0xff) << 8) | (msg[4] & 0xff);
	int dataType = ((msg[5] & 0xff) << 24) | ((msg[6] & 0xff) << 16)
			| ((msg[7] & 0xff) << 8) | (msg[8] & 0xff);
	int len = ((msg[9] & 0xff) << 24) | ((msg[10] & 0xff) << 16)
			| ((msg[11] & 0xff) << 8) | (msg[12] & 0xff);

	Channel c = getChannel(id);

	if (c == null)
		throw new IOException(
				"Unexpected SSH_MSG_CHANNEL_EXTENDED_DATA message for non-existent channel "
						+ id);

	if (dataType != Packets.SSH_EXTENDED_DATA_STDERR)
		throw new IOException(
				"SSH_MSG_CHANNEL_EXTENDED_DATA message has unknown type ("
						+ dataType + ")");

	if (len != (msglen - 13))
		throw new IOException(
				"SSH_MSG_CHANNEL_EXTENDED_DATA message has wrong len (calculated "
						+ (msglen - 13) + ", got " + len + ")");

	if (log.isEnabled())
		log.log(80, "Got SSH_MSG_CHANNEL_EXTENDED_DATA (channel " + id
				+ ", " + len + ")");

	synchronized (c) {
		if (c.state == Channel.STATE_CLOSED)
			return; // ignore

		if (c.state != Channel.STATE_OPEN)
			throw new IOException(
					"Got SSH_MSG_CHANNEL_EXTENDED_DATA, but channel is not in correct state ("
							+ c.state + ")");

		if (c.localWindow < len)
			throw new IOException(
					"Remote sent too much data, does not fit into window.");

		c.localWindow -= len;

		System.arraycopy(msg, 13, c.stderrBuffer, c.stderrWritepos, len);
		c.stderrWritepos += len;

		c.notifyAll();
	}
}
 
开发者ID:jianlinwei,项目名称:sshtunnel,代码行数:56,代码来源:ChannelManager.java


注:本文中的com.trilead.ssh2.packets.Packets.SSH_EXTENDED_DATA_STDERR属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。