public abstract class

AbstractChannel

extends Object
implements Channel
java.lang.Object
   ↳ net.schmizz.sshj.connection.channel.AbstractChannel
Known Direct Subclasses
Known Indirect Subclasses

Summary

Constants
int REMOTE_MAX_PACKET_SIZE_CEILING
Fields
private boolean autoExpand
private final Queue<Event<ConnectionException>> chanReqResponseEvents
protected final Event<ConnectionException> closeEvent Channel close event
private boolean closeRequested
protected final Connection conn Connection layer
private boolean eofGot
private boolean eofSent
private final int id Channel ID
private final ChannelInputStream in stdout stream
protected final Logger log Logger
protected final Window.Local lwin Local window
private final ReentrantLock openCloseLock
protected final Event<ConnectionException> openEvent Channel open event
private ChannelOutputStream out stdin stream
private int recipient Remote recipient ID
protected Window.Remote rwin Remote window
protected final Transport trans Transport layer
private final String type Channel type
Protected Constructors
AbstractChannel(Connection conn, String type)
Public Methods
void close()
Close this channel.
boolean getAutoExpand()
int getID()
InputStream getInputStream()
int getLocalMaxPacketSize()
long getLocalWinSize()
OutputStream getOutputStream()
int getRecipient()
int getRemoteMaxPacketSize()
long getRemoteWinSize()
String getType()
void handle(Message msg, SSHPacket buf)
Delegate handling of some SSH packet to this object.
synchronized boolean isOpen()
void join(int timeout, TimeUnit unit)
void join()
void notifyError(SSHException error)
Notifies this object of an error.
synchronized void sendEOF()
Sends an EOF message to the server for this channel; indicating that no more data will be sent by us.
void setAutoExpand(boolean autoExpand)
Set whether local window should automatically expand when data is received, irrespective of whether data has been read from that stream.
String toString()
Protected Methods
void closeAllStreams()
Called when all I/O streams should be closed.
void eofInputStreams()
Called when EOF has been received.
void finishOff()
void gotExtendedData(SSHPacket buf)
void gotUnknown(Message msg, SSHPacket buf)
void handleRequest(String reqType, SSHPacket buf)
void init(int recipient, long remoteWinSize, long remoteMaxPacketSize)
SSHPacket newBuffer(Message cmd)
void receiveInto(ChannelInputStream stream, SSHPacket buf)
Event<ConnectionException> sendChannelRequest(String reqType, boolean wantReply, Buffer.PlainBuffer reqSpecific)
synchronized void sendClose()
[Expand]
Inherited Methods
From class java.lang.Object
From interface java.io.Closeable
From interface net.schmizz.sshj.common.ErrorNotifiable
From interface net.schmizz.sshj.common.SSHPacketHandler
From interface net.schmizz.sshj.connection.channel.Channel

Constants

private static final int REMOTE_MAX_PACKET_SIZE_CEILING

Constant Value: 1048576 (0x00100000)

Fields

private boolean autoExpand

private final Queue<Event<ConnectionException>> chanReqResponseEvents

protected final Event<ConnectionException> closeEvent

Channel close event

private boolean closeRequested

protected final Connection conn

Connection layer

private boolean eofGot

private boolean eofSent

private final int id

Channel ID

private final ChannelInputStream in

stdout stream

protected final Logger log

Logger

protected final Window.Local lwin

Local window

private final ReentrantLock openCloseLock

protected final Event<ConnectionException> openEvent

Channel open event

private ChannelOutputStream out

stdin stream

private int recipient

Remote recipient ID

protected Window.Remote rwin

Remote window

protected final Transport trans

Transport layer

private final String type

Channel type

Protected Constructors

protected AbstractChannel (Connection conn, String type)

Parameters
conn
type

Public Methods

public void close ()

Close this channel.

public boolean getAutoExpand ()

public int getID ()

public InputStream getInputStream ()

public int getLocalMaxPacketSize ()

public long getLocalWinSize ()

public OutputStream getOutputStream ()

public int getRecipient ()

public int getRemoteMaxPacketSize ()

public long getRemoteWinSize ()

public String getType ()

public void handle (Message msg, SSHPacket buf)

Delegate handling of some SSH packet to this object.

Parameters
msg The SSH message identifier
buf SSHPacket containing rest of the request

public synchronized boolean isOpen ()

public void join (int timeout, TimeUnit unit)

Parameters
timeout
unit

public void join ()

public void notifyError (SSHException error)

Notifies this object of an error.

Parameters
error

public synchronized void sendEOF ()

Sends an EOF message to the server for this channel; indicating that no more data will be sent by us. The OutputStream for this channel will be closed and no longer usable.

public void setAutoExpand (boolean autoExpand)

Set whether local window should automatically expand when data is received, irrespective of whether data has been read from that stream. This is useful e.g. when a remote command produces a lot of output that would fill the local window but you are not interested in reading from its InputStream.

Parameters
autoExpand Whether local windows should automatically expand

public String toString ()

Protected Methods

protected void closeAllStreams ()

Called when all I/O streams should be closed. Subclasses can override but must call super.

protected void eofInputStreams ()

Called when EOF has been received. Subclasses can override but must call super.

protected void finishOff ()

protected void gotExtendedData (SSHPacket buf)

Parameters
buf

protected void gotUnknown (Message msg, SSHPacket buf)

Parameters
msg
buf

protected void handleRequest (String reqType, SSHPacket buf)

Parameters
reqType
buf

protected void init (int recipient, long remoteWinSize, long remoteMaxPacketSize)

Parameters
recipient
remoteWinSize
remoteMaxPacketSize

protected SSHPacket newBuffer (Message cmd)

Parameters
cmd

protected void receiveInto (ChannelInputStream stream, SSHPacket buf)

Parameters
stream
buf

protected Event<ConnectionException> sendChannelRequest (String reqType, boolean wantReply, Buffer.PlainBuffer reqSpecific)

Parameters
reqType
wantReply
reqSpecific

protected synchronized void sendClose ()