examples
Class FTPToSFTPProxy

java.lang.Object
  extended bycom.mindbright.ssh2.SSH2FTPOverSFTP
      extended byexamples.FTPToSFTPProxy
All Implemented Interfaces:
FTPServerEventHandler

public class FTPToSFTPProxy
extends SSH2FTPOverSFTP

This is a demo of one usage of the FTP over SFTP bridging capability. It starts a local server which acts like an ftp server except that the ftp username is used to address different ssh2 servers (with sftp enabled) to connect to. The format of the ftp username is:

 ssh2-user@ssh2-host[:port]
 

 usage: FTPToSFTPProxy [<listen-address>[:<port>]]
 


Field Summary
static java.lang.String IDENTITY
           
 
Fields inherited from class com.mindbright.ssh2.SSH2FTPOverSFTP
connection, ftp, sftp
 
Constructor Summary
FTPToSFTPProxy(java.io.InputStream ftpInput, java.io.OutputStream ftpOutput)
           
 
Method Summary
 SecureRandomAndPad createSecureRandom()
           
 boolean login(java.lang.String user, java.lang.String pass)
          Login to server.
static void main(java.lang.String[] argv)
           
 void quit()
          Close the ftp session.
 
Methods inherited from class com.mindbright.ssh2.SSH2FTPOverSFTP
abort, changeDirectory, delete, initFTP, initSFTP, isPlainFile, list, mkdir, modTime, nameList, pwd, renameFrom, renameTo, retrieve, rmdir, size, store, system
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IDENTITY

public static final java.lang.String IDENTITY
See Also:
Constant Field Values
Constructor Detail

FTPToSFTPProxy

public FTPToSFTPProxy(java.io.InputStream ftpInput,
                      java.io.OutputStream ftpOutput)
Method Detail

login

public boolean login(java.lang.String user,
                     java.lang.String pass)
Description copied from class: SSH2FTPOverSFTP
Login to server. This is actually a null operation for this class since the user is already authenticated as part of the SSH connection.

Specified by:
login in interface FTPServerEventHandler
Overrides:
login in class SSH2FTPOverSFTP
Parameters:
user - Username to login as.
pass - Password.
Returns:
Returns true if the login was successful.

quit

public void quit()
Description copied from interface: FTPServerEventHandler
Close the ftp session.

Specified by:
quit in interface FTPServerEventHandler
Overrides:
quit in class SSH2FTPOverSFTP

createSecureRandom

public SecureRandomAndPad createSecureRandom()

main

public static void main(java.lang.String[] argv)