# Channel (sshj 0.5.0 API)
Date: 2011-07-27

## net.schmizz.sshj.connection.channel
Interface Channel

All Superinterfaces:
  Closeable, ErrorNotifiable, SSHPacketHandler

All Known Subinterfaces:
  Channel.Direct, Channel.Forwarded, Session, Session.Command, Session.Shell, Session.Subsystem

All Known Implementing Classes:
  AbstractChannel, AbstractDirectChannel, AbstractForwardedChannel, RemotePortForwarder.ForwardedTCPIPChannel, SessionChannel, X11Forwarder.X11Channel

    public interface Channel

extends Closeable, SSHPacketHandler, ErrorNotifiable

A channel is the basic medium for application-layer data on top of an SSH transport.

Nested Class Summary
`static interface` `Channel.Direct` Direct channels are those that are initiated by us.
`static interface` `Channel.Forwarded` Forwarded channels are those that are initiated by the server.

Nested classes/interfaces inherited from interface net.schmizz.sshj.common.ErrorNotifiable
`ErrorNotifiable.Util`

Method Summary
`void` `close()` Close this channel.
`boolean` `getAutoExpand()`
`int` `getID()`
`InputStream` `getInputStream()`
`int` `getLocalMaxPacketSize()`
`int` `getLocalWinSize()`
`OutputStream` `getOutputStream()`
`int` `getRecipient()`
`int` `getRemoteMaxPacketSize()`
`int` `getRemoteWinSize()`
`String` `getType()`
`boolean` `isOpen()`
`void` `join()`
`void` `join(int timeout, TimeUnit unit)`
`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.

Methods inherited from interface net.schmizz.sshj.common.SSHPacketHandler
`handle`

Methods inherited from interface net.schmizz.sshj.common.ErrorNotifiable
`notifyError`

Method Detail

### close

    void close()
               throws TransportException,
                      ConnectionException

  Close this channel.

  Specified by:
    `close` in interface `Closeable`
  Throws:
    `TransportException`
    `ConnectionException`

### getAutoExpand

    boolean getAutoExpand()

  Returns:
    whether auto-expansion of local window is set.
  See Also:
    `setAutoExpand(boolean)`

### getID

    int getID()

  Returns:
    the channel ID

### getInputStream

    InputStream getInputStream()

  Returns:
    the `InputStream` for this channel.

### getLocalMaxPacketSize

    int getLocalMaxPacketSize()

  Returns:
    the maximum packet size that we have specified.

### getLocalWinSize

    int getLocalWinSize()

  Returns:
    the current local window size.

### getOutputStream

    OutputStream getOutputStream()

  Returns:
    an `OutputStream` for this channel.

### getRecipient

    int getRecipient()

  Returns:
    the channel ID at the remote end.

### getRemoteMaxPacketSize

    int getRemoteMaxPacketSize()

  Returns:
    the maximum packet size as specified by the remote end.

### getRemoteWinSize

    int getRemoteWinSize()

  Returns:
    the current remote window size.

### getType

    String getType()

  Returns:
    the channel type identifier.

### isOpen

    boolean isOpen()

  Returns:
    whether the channel is open.

### sendEOF

    void sendEOF()
                 throws TransportException

  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.

  Throws:
    `TransportException` - if there is an error sending the EOF message

### setAutoExpand

    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

### join

    void join()
              throws ConnectionException

  Throws:
    `ConnectionException`

### join

    void join(int timeout,
              TimeUnit unit)
              throws ConnectionException

  Throws:
    `ConnectionException`

Copyright © 2009-2011. All Rights Reserved.