Secure iNet Factory

com.jscape.inet.ssh
Class SshConnection

java.lang.Object
  extended by com.jscape.inet.ssh.SshConnection
All Implemented Interfaces:
com.jscape.inet.util.connection.Connection

public class SshConnection
extends java.lang.Object
implements com.jscape.inet.util.connection.Connection

SSH connection.

Version:
1.0
Author:
Alex
See Also:
Source code

Constructor Summary
SshConnection(ConnectionClient connection, Channel channel, boolean owner)
          Creates a new connection instance.
 
Method Summary
 void close()
          Closes the current connection.
 Channel getChannel()
          Returns underlayed channel.
 ConnectionClient getConnection()
          Returns underlayed connection.
 java.io.InputStream getInputStream()
          Returns connection input stream.
 java.lang.String getLocalAddress()
          Returns local address.
 int getLocalPort()
          Returns local port.
 java.io.OutputStream getOutputStream()
          Returns connection output stream.
 java.lang.String getRemoteAddress()
          Returns remote end address.
 int getRemotePort()
          Returns remote end port.
 long getTimeout()
          Returns connection timeout.
 boolean isClosed()
          Checks if connection is already closed.
 boolean isOwner()
          Checks if the underlayed connection is owned by current instance.
 void setTimeout(long timeout)
          Setups connection timeout.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SshConnection

public SshConnection(ConnectionClient connection,
                     Channel channel,
                     boolean owner)
Creates a new connection instance.

Parameters:
connection - connection
channel - channel
owner - ownership flag
Method Detail

getRemoteAddress

public java.lang.String getRemoteAddress()
Description copied from interface: com.jscape.inet.util.connection.Connection
Returns remote end address.

Specified by:
getRemoteAddress in interface com.jscape.inet.util.connection.Connection
Returns:
remote end address
See Also:
Connection.getRemoteAddress()

getRemotePort

public int getRemotePort()
Description copied from interface: com.jscape.inet.util.connection.Connection
Returns remote end port.

Specified by:
getRemotePort in interface com.jscape.inet.util.connection.Connection
Returns:
remote rns port
See Also:
Connection.getRemotePort()

getLocalAddress

public java.lang.String getLocalAddress()
Description copied from interface: com.jscape.inet.util.connection.Connection
Returns local address.

Specified by:
getLocalAddress in interface com.jscape.inet.util.connection.Connection
Returns:
local address
See Also:
Connection.getLocalAddress()

getLocalPort

public int getLocalPort()
Description copied from interface: com.jscape.inet.util.connection.Connection
Returns local port.

Specified by:
getLocalPort in interface com.jscape.inet.util.connection.Connection
Returns:
local port
See Also:
Connection.getLocalPort()

getTimeout

public long getTimeout()
                throws java.io.IOException
Description copied from interface: com.jscape.inet.util.connection.Connection
Returns connection timeout.

Specified by:
getTimeout in interface com.jscape.inet.util.connection.Connection
Returns:
connection timeout
Throws:
java.io.IOException - if an error occurs
See Also:
Connection.getTimeout()

setTimeout

public void setTimeout(long timeout)
                throws java.io.IOException
Description copied from interface: com.jscape.inet.util.connection.Connection
Setups connection timeout.

Specified by:
setTimeout in interface com.jscape.inet.util.connection.Connection
Parameters:
timeout - new timeout value
Throws:
java.io.IOException - if an error occurs
See Also:
Connection.setTimeout(long)

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
Description copied from interface: com.jscape.inet.util.connection.Connection
Returns connection input stream.

Specified by:
getInputStream in interface com.jscape.inet.util.connection.Connection
Returns:
connection input stream
Throws:
java.io.IOException - if an I/O error occurs
See Also:
Connection.getInputStream()

getOutputStream

public java.io.OutputStream getOutputStream()
                                     throws java.io.IOException
Description copied from interface: com.jscape.inet.util.connection.Connection
Returns connection output stream.

Specified by:
getOutputStream in interface com.jscape.inet.util.connection.Connection
Returns:
connection output stream
Throws:
java.io.IOException - if an I/O error occurs
See Also:
Connection.getOutputStream()

isClosed

public boolean isClosed()
Description copied from interface: com.jscape.inet.util.connection.Connection
Checks if connection is already closed.

Specified by:
isClosed in interface com.jscape.inet.util.connection.Connection
Returns:
true if connection is closed; false otherwise
See Also:
Connection.isClosed()

getConnection

public ConnectionClient getConnection()
Returns underlayed connection.

Returns:
underlayed connection

getChannel

public Channel getChannel()
Returns underlayed channel.

Returns:
underlayed channel

isOwner

public boolean isOwner()
Checks if the underlayed connection is owned by current instance.

Returns:
true if underlayed connection is owned; false otherwise

close

public void close()
Description copied from interface: com.jscape.inet.util.connection.Connection
Closes the current connection.

Specified by:
close in interface com.jscape.inet.util.connection.Connection
See Also:
Connection.close()

Secure iNet Factory

Copyright © JSCAPE LLC. 1999-2011. All Rights Reserved