com.ssh.sft
Class Session

java.lang.Object
  extended bycom.ssh.sft.SftLib
      extended bycom.ssh.sft.SftBase
          extended bycom.ssh.sft.ObjectBase
              extended bycom.ssh.sft.Session
All Implemented Interfaces:
com.ssh.sft.SftLibConstants

public class Session
extends com.ssh.sft.ObjectBase

An ongoing SFTP session in a remote or local host. Each Session object represents a connection to an SFTP server or to a virtual server that can be used to access the local filesystem. There may be several sessions to a single server, and each session supports multiple concurrent operations.


Field Summary
static int SSH_SFT_DIR_RECURSIVE
           
static int SSH_SFT_HASH_MAX_BLOCK_SIZE
           
static int SSH_SFT_HASH_MAX_ITERATIONS
           
static int SSH_SFT_HASH_MIN_BLOCK_SIZE
           
static int SSH_SFT_REQUEST_MAX_NUM
           
static int SSH_SFT_REQUEST_MAX_SIZE
           
 
Method Summary
 void abort()
          Aborts the session.
 void close()
          Releases the resources used by this object.
 byte[] getExtensionData(String type)
          Returns SFTP protocol extension data that the server has sent.
 File getFile(String path)
          Returns a File object representing the file at the named path.
 Location getLocation(String path)
          Returns a Location representing the named path.
 long getProtocolVersion()
          Returns the version of the SFTP protocol that is used in this session for communicating with the SFTP server.
 URI getURI()
          Returns the URI for this session's SFTP server.
 boolean isClosed()
          Tests if this object has been closed.
 boolean isConnected()
           
 void resume()
          Resumes the session.
 void setFileCopyPrefix(String prefix)
           
 void setForceLowerCase(boolean force)
           
 void setIncrementalChecksums()
           
 void suspend()
          Suspends the session.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SSH_SFT_REQUEST_MAX_SIZE

public static final int SSH_SFT_REQUEST_MAX_SIZE
See Also:
Constant Field Values

SSH_SFT_REQUEST_MAX_NUM

public static final int SSH_SFT_REQUEST_MAX_NUM
See Also:
Constant Field Values

SSH_SFT_HASH_MAX_ITERATIONS

public static final int SSH_SFT_HASH_MAX_ITERATIONS
See Also:
Constant Field Values

SSH_SFT_HASH_MIN_BLOCK_SIZE

public static final int SSH_SFT_HASH_MIN_BLOCK_SIZE
See Also:
Constant Field Values

SSH_SFT_HASH_MAX_BLOCK_SIZE

public static final int SSH_SFT_HASH_MAX_BLOCK_SIZE
See Also:
Constant Field Values

SSH_SFT_DIR_RECURSIVE

public static final int SSH_SFT_DIR_RECURSIVE
See Also:
Constant Field Values
Method Detail

getProtocolVersion

public long getProtocolVersion()
Returns the version of the SFTP protocol that is used in this session for communicating with the SFTP server.

Returns:
the protocol version

getExtensionData

public byte[] getExtensionData(String type)
                        throws SftException
Returns SFTP protocol extension data that the server has sent.

Parameters:
type - the type of the data to get
Returns:
the extension data associated with the given type
Throws:
SftException

getLocation

public Location getLocation(String path)
Returns a Location representing the named path.

Parameters:
path - the path to access
Returns:
a Location object representing the named path accessed through this session

getFile

public File getFile(String path)
             throws NoSuchFileException,
                    SftException
Returns a File object representing the file at the named path.

Parameters:
path - the path to access
Returns:
a File object representing the file currently found at the named path
Throws:
NoSuchFileException - if no file exists at the named path
SftException

suspend

public void suspend()
Suspends the session. All currently active file operations in this session are paused until suspend() is called. If the session is already suspended, invoking this method has no effect.


resume

public void resume()
Resumes the session. If the session was suspended, all paused operations are now resumed. Otherwise, this method has no effect.


abort

public void abort()
Aborts the session. All currently active file operations are terminated and they throw an AbortedException.


setForceLowerCase

public void setForceLowerCase(boolean force)

setFileCopyPrefix

public void setFileCopyPrefix(String prefix)

setIncrementalChecksums

public void setIncrementalChecksums()

getURI

public URI getURI()
Returns the URI for this session's SFTP server. The URI is of the form "sftp://user@host".


isConnected

public boolean isConnected()

close

public void close()
           throws SftException
Releases the resources used by this object. After this method has been called, all further operations on this object will throw a IllegalStateException.

Throws:
SftException

isClosed

public boolean isClosed()
Tests if this object has been closed.

Returns:
true if ObjectBase.close() has been called on this object, false otherwise