IRISLIB database
SFTP Class Reference
Inheritance diagram for SFTP:
Collaboration diagram for SFTP:

Public Member Functions

_.Library.Status CloseSFTP ()
 Close the SFTP session.
 
_.Library.Status Delete (_.Library.String file)
 Delete a file on the remote server.
 
_.Library.Status Dir (_.Library.String directory, contents, _.Library.String spec, _.Library.Boolean dotFiles)
 Enumerate the contents of a directory. More...
 
_.Library.Status DirEnum (_.Library.String directory, _.Library.RegisteredObject oref, _.Library.String method)
 Enumerate the contents of a directory by calling the specified instance method once for each entry. More...
 
_.Library.Status FileInfo (_.Library.String file, _.Library.List info)
 Gets information about a file. More...
 
_.Library.Status Get (_.Library.String remote, _.Library.String local, _.Library.String localmode, _.Library.Boolean append)
 Get a file from the remote system, storing it in the local file system with the specified mode (access).
 
_.Library.Status GetBufferSize (_.Library.Integer pBufferSize)
 Gets the transfer buffer size for SFTP operations (in bytes).
 
_.Library.Status GetStream (_.Library.String remote, _.Stream.Object stream, _.Library.Boolean append)
 Get a file from the remote system, storing it in the stream. More...
 
_.Library.Status MkDir (_.Library.String directory, _.Library.String remotemode)
 Create a new directory on the remote server, with the specified file mode (access).
 
_.Library.Status Put (_.Library.String local, _.Library.String remote, _.Library.String remotemode, _.Library.Boolean append)
 Put a file from the local filesystem to the remote server, setting the specified mode (access).
 
_.Library.Status PutStream (_.Stream.Object stream, _.Library.String remote, _.Library.String remotemode, _.Library.Boolean append)
 Put a stream to the remote system, setting the specified mode (access). More...
 
_.Library.Status Rename (_.Library.String old, _.Library.String new)
 Rename a file on the remote server.
 
_.Library.Status RmDir (_.Library.String directory)
 Remove a directory on the remote server.
 
_.Library.Status SetBufferSize (_.Library.Integer pBufferSize)
 Sets the transfer buffer size for SFTP operations (in bytes). More...
 
_.Library.Status SetFileTime (_.Library.String remote, _.Library.TimeStamp atimeUTC, _.Library.TimeStamp mtimeUTC)
 Change the access and last modification times for the specified file (you must be the current owner or root). More...
 
_.Library.Status SetOwnerAndGroup (_.Library.String remote, _.Library.Integer uid, _.Library.Integer gid)
 Change the uid/gid for the specified file or directory (you must be the current owner or root).
 
_.Library.Status SetPermissions (_.Library.String remote, _.Library.String mode)
 Change the permissions mode for the specified file or directory.
 
_.Library.Status SetSize (_.Library.String remote, _.Library.Integer size)
 Change the size of the specified file (by either truncating or extending it).
 
_.Library.Status SymLink (_.Library.String source, _.Library.String target)
 Create a symlink on the remote server.
 
_.Library.Status Touch (_.Library.String remote)
 Touch the file to have an access time of now.
 
- Public Member Functions inherited from RegisteredObject
_.Library.Status OnAddToSaveSet (_.Library.Integer depth, _.Library.Integer insert, _.Library.Integer callcount)
 This callback method is invoked when the current object is added to the SaveSet,. More...
 
_.Library.Status OnConstructClone (_.Library.RegisteredObject object, _.Library.Boolean deep, _.Library.String cloned)
 This callback method is invoked by the <METHOD>ConstructClone</METHOD> method to. More...
 
_.Library.Status OnNew ()
 This callback method is invoked by the <METHOD>New</METHOD> method to. More...
 
_.Library.Status OnValidateObject ()
 This callback method is invoked by the <METHOD>ValidateObject</METHOD> method to. More...
 

Static Public Member Functions

_.Library.Integer H2UTCFileTime (_.Library.String horolog)
 Convert $HOROLOG to UNIX file time; note that UNIX time is the number of seconds since Midnight Jan 1, 1970. More...
 
_.Library.String Permissions2Text (_.Library.Integer permissions)
 Convert UNIX permissions flags to a string.
 
_.Library.Status Test (_.Library.String host, _.Library.String username, _.Library.String password, _.Library.String dir, _.Library.String spec, _.Library.Boolean dotFiles, t)
 Demonstrates use of an SFTP session to enumerate the contents of the /etc directory on the remote. More...
 
_.Library.Status TestPut (_.Library.String host, _.Library.String username, _.Library.String password, _.Library.String srcfile, _.Library.String destfile)
 Demonstrates use of an SFTP session to put a file to the remote. More...
 
_.Library.String UTCFileTime2H (_.Library.Integer filetime)
 Convert UNIX file time to $HOROLOG, for UNIX time is the number of seconds since Midnight Jan 1, 1970. More...
 

Public Attributes

 SSH
 SSH Session that hosts this SFTP session. More...
 
 Version
 SFTP Remote Server Version. More...
 

Private Member Functions

_.Library.Status OnClose ()
 Clean up any resources.
 

Additional Inherited Members

- Static Public Attributes inherited from RegisteredObject
 CAPTION = None
 Optional name used by the Form Wizard for a class when generating forms. More...
 
 JAVATYPE = None
 The Java type to be used when exported.
 
 PROPERTYVALIDATION = None
 This parameter controls the default validation behavior for the object. More...
 

Detailed Description

For information on using this class, see Using SSH.

A wrapper object for an SFTP session running over and existing SSH connection. Use the OpenSFTP() method of a previously connected and authenticated Net.SSH.Session to instantiate a valid SFTP object for use.
You should NOT create instances of Net.SSH.SFTP directly!
NOTE: Net.SSH is currently not supported on OpenVMS platforms.

Member Function Documentation

◆ Dir()

_.Library.Status Dir ( _.Library.String  directory,
  contents,
_.Library.String  spec,
_.Library.Boolean  dotFiles 
)

Enumerate the contents of a directory.

Populates the contents array with $LIST entries for

each file in the directory, subscripted by a integer sequence, the $LIST is composed in the same format as with the <method>FileInfo()<method> method.
The optional spec parameter allows for wildcards when searching the directory. The wildcards that can be used are as follows:

  • *: Match zero or more characters
  • ?: Match exactly one character

Some examples are:

    *.txt
    journal_???.*
    201?-??-??.log
    

◆ DirEnum()

Enumerate the contents of a directory by calling the specified instance method once for each entry.

in the directory. The signature of the callback should take two arguments, first an integer sequence number and secondly a $LIST composed in the same format as with the FileInfo() method (see FileInfo).

◆ FileInfo()

_.Library.Status FileInfo ( _.Library.String  file,
_.Library.List  info 
)

Gets information about a file.

On return, info is a $LIST containing:

  1) Filename
  2) Size
  3) File type
     P: Named pipe (FIFO)
     C: Character special
     D: Directory
     B: Block special
     F: Regular file
     L: Symbolic link
     S: Socket
     U: Unknown
  4) Permissions
  5) UID
  6) GID
  7) Last Access Time
  8) Last Modification Time

Depending on the remote system, some information may not be available and
will be indicated by a null list element.

◆ GetStream()

_.Library.Status GetStream ( _.Library.String  remote,
_.Stream.Object  stream,
_.Library.Boolean  append 
)

Get a file from the remote system, storing it in the stream.

If stream not defined on entry it will create a stream for this automatically. If stream is a file stream we will just link to the file we created.

◆ H2UTCFileTime()

_.Library.Integer H2UTCFileTime ( _.Library.String  horolog)
static

Convert $HOROLOG to UNIX file time; note that UNIX time is the number of seconds since Midnight Jan 1, 1970.

which has a $HOROLOG date of 47117,0

◆ PutStream()

_.Library.Status PutStream ( _.Stream.Object  stream,
_.Library.String  remote,
_.Library.String  remotemode,
_.Library.Boolean  append 
)

Put a stream to the remote system, setting the specified mode (access).

If stream is a file stream we will just link to the file already present, otherwise we create a temp file to send.

◆ SetBufferSize()

_.Library.Status SetBufferSize ( _.Library.Integer  pBufferSize)

Sets the transfer buffer size for SFTP operations (in bytes).

The default is 1MB, performance may be

degraded when this is set to small values.

◆ SetFileTime()

_.Library.Status SetFileTime ( _.Library.String  remote,
_.Library.TimeStamp  atimeUTC,
_.Library.TimeStamp  mtimeUTC 
)

Change the access and last modification times for the specified file (you must be the current owner or root).

NOTE: Timestamp values must be in UTC time (see $ZTIMESTAMP).

◆ Test()

_.Library.Status Test ( _.Library.String  host,
_.Library.String  username,
_.Library.String  password,
_.Library.String  dir,
_.Library.String  spec,
_.Library.Boolean  dotFiles,
  t 
)
static

Demonstrates use of an SFTP session to enumerate the contents of the /etc directory on the remote.

server.

◆ TestPut()

_.Library.Status TestPut ( _.Library.String  host,
_.Library.String  username,
_.Library.String  password,
_.Library.String  srcfile,
_.Library.String  destfile 
)
static

Demonstrates use of an SFTP session to put a file to the remote.

server.

◆ UTCFileTime2H()

_.Library.String UTCFileTime2H ( _.Library.Integer  filetime)
static

Convert UNIX file time to $HOROLOG, for UNIX time is the number of seconds since Midnight Jan 1, 1970.

which has a $HOROLOG date of 47117,0

Member Data Documentation

◆ SSH

SSH

SSH Session that hosts this SFTP session.

 

◆ Version

Version

SFTP Remote Server Version.