|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.mindbright.ssh2.SSH2FTPOverSFTP
Implements a proxy which proxies between an ftp client and an sftp server.
| Field Summary | |
protected SSH2Connection |
connection
The SSH2Connection to use |
protected FTPServer |
ftp
FTP server instance |
protected SSH2SFTPClient |
sftp
SFTP client instance |
| Constructor Summary | |
protected |
SSH2FTPOverSFTP(java.io.InputStream ftpInput,
java.io.OutputStream ftpOutput,
java.lang.String identity,
boolean needPassword)
|
|
SSH2FTPOverSFTP(SSH2Connection connection,
java.io.InputStream ftpInput,
java.io.OutputStream ftpOutput,
boolean remoteIsWindows,
java.lang.String identity)
|
|
SSH2FTPOverSFTP(SSH2Connection connection,
java.io.InputStream ftpInput,
java.io.OutputStream ftpOutput,
java.lang.String identity)
|
| Method Summary | |
void |
abort()
|
void |
changeDirectory(java.lang.String dir)
Change current directory on the server. |
void |
chmod(int mod,
java.lang.String file)
Modify the file permissions. |
void |
delete(java.lang.String file)
Delete the given file. |
protected void |
initFTP(java.io.InputStream ftpInput,
java.io.OutputStream ftpOutput,
boolean remoteIsWindows,
java.lang.String identity,
boolean needPassword)
Initialize the FTP server portion of this class. |
protected void |
initFTP(java.io.InputStream ftpInput,
java.io.OutputStream ftpOutput,
java.lang.String identity,
boolean needPassword)
Initialize the FTP server portion of this class. |
protected void |
initSFTP(SSH2Connection connection)
Connect this instance with an SSH2Connection which is
connected to the server we want to transfer files to/from. |
boolean |
isPlainFile(java.lang.String file)
Check if the name refers to a normal file as opposed to for example a directory. |
void |
list(java.lang.String path,
java.io.OutputStream data)
Lists the names of the files and directories in the given directory. |
boolean |
login(java.lang.String user,
java.lang.String pass)
Login to server. |
void |
mkdir(java.lang.String dir)
Create a new directory. |
long |
modTime(java.lang.String file)
Find out when a file was last modified. |
void |
nameList(java.lang.String path,
java.io.OutputStream data)
Lists the contents of the given directory. |
java.lang.String |
pwd()
Get the current working directory. |
void |
quit()
Close the ftp session. |
void |
renameFrom(java.lang.String from)
The first step in a rename operation. |
void |
renameTo(java.lang.String to)
The second step in the rename operation. |
void |
retrieve(java.lang.String file,
java.io.OutputStream data,
boolean binary)
Retrieve a file from the server. |
void |
rmdir(java.lang.String dir)
Remove the given directory. |
long |
size(java.lang.String file)
Get the size of a file. |
void |
store(java.lang.String file,
java.io.InputStream data,
boolean binary)
Store a file on the server. |
java.lang.String |
system()
Get the type of system the server is running. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected SSH2Connection connection
SSH2Connection to use
protected SSH2SFTPClient sftp
protected FTPServer ftp
| Constructor Detail |
protected SSH2FTPOverSFTP(java.io.InputStream ftpInput,
java.io.OutputStream ftpOutput,
java.lang.String identity,
boolean needPassword)
public SSH2FTPOverSFTP(SSH2Connection connection,
java.io.InputStream ftpInput,
java.io.OutputStream ftpOutput,
java.lang.String identity)
throws SSH2SFTP.SFTPException
public SSH2FTPOverSFTP(SSH2Connection connection,
java.io.InputStream ftpInput,
java.io.OutputStream ftpOutput,
boolean remoteIsWindows,
java.lang.String identity)
throws SSH2SFTP.SFTPException
| Method Detail |
protected void initSFTP(SSH2Connection connection)
throws SSH2SFTP.SFTPException
SSH2Connection which is
connected to the server we want to transfer files to/from.
connection - Established connection to the server.
SSH2SFTP.SFTPException
protected void initFTP(java.io.InputStream ftpInput,
java.io.OutputStream ftpOutput,
java.lang.String identity,
boolean needPassword)
ftpInput - The ftp command input stream.ftpOutput - The ftp command output stream.identity - Username to log in asneedPassword - Tells the instance if it should request a
password or not from the user. The actual password
the user then gives is ignored.
protected void initFTP(java.io.InputStream ftpInput,
java.io.OutputStream ftpOutput,
boolean remoteIsWindows,
java.lang.String identity,
boolean needPassword)
ftpInput - The ftp command input stream.ftpOutput - The ftp command output stream.remoteIsWindows - Whether remote system is a Windows system or not.identity - Username to log in asneedPassword - Tells the instance if it should request a
password or not from the user. The actual password
the user then gives is ignored.
public boolean login(java.lang.String user,
java.lang.String pass)
login in interface FTPServerEventHandleruser - Username to login as.pass - Password.
public void quit()
FTPServerEventHandler
quit in interface FTPServerEventHandlerpublic boolean isPlainFile(java.lang.String file)
FTPServerEventHandler
isPlainFile in interface FTPServerEventHandlerfile - The name of the file.
public void changeDirectory(java.lang.String dir)
throws FTPException
FTPServerEventHandler
changeDirectory in interface FTPServerEventHandlerdir - Name of new directory
FTPException
public void renameFrom(java.lang.String from)
throws FTPException
FTPServerEventHandlerrenameTo.
renameFrom in interface FTPServerEventHandlerfrom - The name of the file to rename.
FTPException
public void renameTo(java.lang.String to)
throws FTPException
FTPServerEventHandlerrenameFrom
renameTo in interface FTPServerEventHandlerto - The new name of the file.
FTPException
public void delete(java.lang.String file)
throws FTPException
FTPServerEventHandler
delete in interface FTPServerEventHandlerfile - Name of the file to delete.
FTPException
public void rmdir(java.lang.String dir)
throws FTPException
FTPServerEventHandler
rmdir in interface FTPServerEventHandlerdir - Directory to remove.
FTPException
public void mkdir(java.lang.String dir)
throws FTPException
FTPServerEventHandler
mkdir in interface FTPServerEventHandlerdir - Name of directory to create.
FTPException
public void chmod(int mod,
java.lang.String file)
throws FTPException
FTPServerEventHandler
chmod in interface FTPServerEventHandlermod - New file permissions.file - Name of file to modify.
FTPExceptionpublic java.lang.String pwd()
FTPServerEventHandler
pwd in interface FTPServerEventHandlerpublic java.lang.String system()
FTPServerEventHandler
system in interface FTPServerEventHandler
public long modTime(java.lang.String file)
throws FTPException
FTPServerEventHandler
modTime in interface FTPServerEventHandlerfile - Name of file to investigate.
FTPException
public long size(java.lang.String file)
throws FTPException
FTPServerEventHandler
size in interface FTPServerEventHandlerfile - Name of file to get the size of.
FTPException
public void store(java.lang.String file,
java.io.InputStream data,
boolean binary)
throws FTPException
FTPServerEventHandler
store in interface FTPServerEventHandlerfile - Name to store file as.data - Stream from which the contents of the file is read.binary - Controls the translating of line endings.
FTPException
public void retrieve(java.lang.String file,
java.io.OutputStream data,
boolean binary)
throws FTPException
FTPServerEventHandler
retrieve in interface FTPServerEventHandlerfile - Name of file to retrieve.data - Stream to which the file content is written.binary - Controls the translating of line endings.
FTPException
public void list(java.lang.String path,
java.io.OutputStream data)
throws FTPException
FTPServerEventHandlernameList is
that the latter appends a trailing '/' to directory names.
list in interface FTPServerEventHandlerpath - Directory to list the contens of.data - Stream to write the results to.
FTPException
public void nameList(java.lang.String path,
java.io.OutputStream data)
throws FTPException
FTPServerEventHandlerlist is
that the this appends a trailing '/' to directory names.
nameList in interface FTPServerEventHandlerpath - Directory to list the contens of.data - Stream to write the results to.
FTPExceptionpublic void abort()
abort in interface FTPServerEventHandler
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||