public class SubsystemChannel extends Object
This class provides useful methods for implementing an SSH2 subsystem. Subsystems typically send messages in the following format.
Messages sent using the methods of this class will have the UINT length automatically added and messages received will be unwrapped with just the type and payload being returned. Although subsystems were defined within the SSH2 connection protocol this class takes a single SshChannel as an argument to its constructor which enables subsystems to run over both SSH1 and SSH2 channels.UINT length byte type byte[length-1] payload
| Modifier and Type | Field and Description |
|---|---|
protected SshChannel |
channel |
| Constructor and Description |
|---|
SubsystemChannel(SshChannel channel)
Create a new subsystem channel.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the subsystem
|
protected Packet |
createPacket()
Get a packet from the available pool or create if non available
|
boolean |
isClosed()
Is the subsystem closed?
|
byte[] |
nextMessage()
Read a subsystem message from the channel inputstream.
|
protected void |
sendMessage(byte[] msg)
|
protected void |
sendMessage(Packet msg)
Write a subsystem message to the channel outputstream.
|
protected SshChannel channel
public SubsystemChannel(SshChannel channel) throws SshException
channel - SshExceptionpublic boolean isClosed()
public void close()
throws IOException
IOExceptionpublic byte[] nextMessage()
throws SshException
SshExceptionprotected void sendMessage(Packet msg) throws SshException
msg - SshExceptionprotected void sendMessage(byte[] msg)
throws SshException
Packet and it is recommended that
all implementations change to use
Packet's as they provide a more
efficent way of sending data.msg - SshExceptionprotected Packet createPacket() throws IOException
IOExceptionCopyright © 2016. All rights reserved.