Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## examples
Class FTPToSFTPProxy

    java.lang.Object
      com.mindbright.ssh2.SSH2FTPOverSFTP
          examples.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: `java -cp examples.jar examples.FTPToSFTPProxy [listen_address[:port]]`

Field Summary

Fields inherited from class com.mindbright.ssh2.SSH2FTPOverSFTP
`connection, ftp, sftp`

Constructor Summary
`FTPToSFTPProxy(java.io.InputStream ftpInput, java.io.OutputStream ftpOutput)` Construct an FTP to SFTP proxy which uses the given streams to communicate with an FTP client.

Method Summary
`boolean` | `login(java.lang.String user, java.lang.String pass)` Connect and log in to the SSH server
`static void` | `main(java.lang.String[] argv)` Run the application
`void` | `quit()` Close connection

Methods inherited from class com.mindbright.ssh2.SSH2FTPOverSFTP
`abort, changeDirectory, chmod, delete, initFTP, 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`

Constructor Detail

### FTPToSFTPProxy

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

  Construct an FTP to SFTP proxy which uses the given streams to communicate with an FTP client.

Parameters:
  `ftpInput` - input stream from ftp client
  `ftpOutput` - output stream to ftp client

Method Detail

### login

    public boolean login(java.lang.String user,
                         java.lang.String pass)

  Connect and log in to the SSH server

  Specified by:
    `login` in interface `FTPServerEventHandler`
  Overrides:
    `login` in class `SSH2FTPOverSFTP`
  Parameters:
    `user` - username to log in as
    `pass` - password to authenticate with
  Returns:
    true if the login was successful.

### quit

    public void quit()

  Close connection

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

### main

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

  Run the application

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD