|
Holger's Java API |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.antelmann.net.FTPConnector
@ThirdParty(value="uses org.apache.commons.net.ftp") public class FTPConnector
FTPConnector implements some useful methods for an FTP client. The methods are synchronized as they use an exclusive connection to the host for performing the operations.
This class uses the package package org.apache.commons.net.ftp,
which is available at
http://jakarta.apache.org/commons/net/index.html.
Alternatively, you may also use the package com.oroinc.net.ftp from the Java NetComponents Library by Original Reusable Objects, which is available at this location. The license for that package is unfortunately NOT GNU, see here for details.
| Field Summary | |
|---|---|
static String |
DIR_SEPARATOR
|
| Constructor Summary | |
|---|---|
FTPConnector(FTPConnector ftpc)
|
|
FTPConnector(String host,
String user,
char[] passwd)
|
|
FTPConnector(String host,
String user,
char[] passwd,
boolean localPassiveMode)
|
|
FTPConnector(String host,
String user,
String passwd)
|
|
FTPConnector(String host,
String user,
String passwd,
boolean localPassiveMode)
|
|
| Method Summary | |
|---|---|
void |
download(String remoteDir,
String remoteFileName,
OutputStream target)
|
void |
download(String remoteDir,
String remoteFileName,
OutputStream target,
Monitor monitor)
downloads a single file from the given FTP site to the specified target stream. |
void |
downloadFile(String remoteDir,
String remoteFileName,
File targetFile)
|
void |
downloadFile(String remoteDir,
String remoteFileName,
File targetFile,
Monitor monitor)
downloads a single file from the given FTP site to the specified target file. |
Object[] |
downloadTree(String remoteSourceDir,
File targetDir)
recursively downloads the remoteSourceDir tree to the targetDir. |
Object[] |
downloadTree(String remoteSourceDir,
File targetDir,
Logger logger)
uses a Logger to provide feedback. |
Object[] |
downloadTree(String remoteSourceDir,
File targetDir,
Logger logger,
Monitor monitor)
uses a Monitor for enabling to cancel the operation prematurely. |
org.apache.commons.net.ftp.FTPClient |
getConnectedFTPClient()
|
String |
getHost()
|
Logger |
getLogger()
acess to the (non-null) Logger suitable for logging entries in the context of this instance |
String[] |
getRemoteDirNames(String remoteDir)
|
String[] |
getRemoteFileNames(String remoteDir,
boolean includeDirNames)
|
String |
getUser()
|
boolean |
isLocalPassiveMode()
|
void |
setAllFrom(FTPConnector ftpc)
copies the properties of the given object and applies them to this instance, so that its behavior in regards to the given object can be matched to the extend that the implementing class supports that behavior. |
void |
setLocalPassiveMode(boolean localPassiveMode)
|
Object[] |
synchronizeDirectory(File sourceDir,
String remoteTargetDir,
boolean deleteRemoteFiles)
synchronizes the sourceDir with the remoteTargetDir on the FTP host recursively. |
Object[] |
synchronizeDirectory(File sourceDir,
String remoteTargetDir,
boolean deleteRemoteFiles,
Logger logger)
This method allows for intermediate feedback through the logger; otherwise it's the same as the other synchronizeDirectory() method. |
Object[] |
synchronizeDirectory(File sourceDir,
String remoteTargetDir,
boolean deleteRemoteFiles,
Logger logger,
Monitor monitor)
This method allows for intermediate feedback and interactive stopping; otherwise it's the same as the other synchronizeDirectory() method. |
void |
uploadFile(File sourceFile,
String targetDir,
String targetFileName)
uploads a single local file to the given FTP site using the specified targetDir and targetFileName. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String DIR_SEPARATOR
| Constructor Detail |
|---|
public FTPConnector(String host,
String user,
String passwd)
public FTPConnector(String host,
String user,
char[] passwd)
public FTPConnector(String host,
String user,
String passwd,
boolean localPassiveMode)
public FTPConnector(String host,
String user,
char[] passwd,
boolean localPassiveMode)
public FTPConnector(FTPConnector ftpc)
| Method Detail |
|---|
public String getHost()
public String getUser()
public Logger getLogger()
LoggerProvider
getLogger in interface LoggerProviderpublic boolean isLocalPassiveMode()
public void setLocalPassiveMode(boolean localPassiveMode)
public void setAllFrom(FTPConnector ftpc)
Forgeable
setAllFrom in interface Forgeable<FTPConnector>ftpc - the object whose behavior is to be copied to this instance
public org.apache.commons.net.ftp.FTPClient getConnectedFTPClient()
throws IOException
IOException
public void uploadFile(File sourceFile,
String targetDir,
String targetFileName)
throws IOException
IOException
public String[] getRemoteFileNames(String remoteDir,
boolean includeDirNames)
throws IOException
IOException
public String[] getRemoteDirNames(String remoteDir)
throws IOException
IOException
public void downloadFile(String remoteDir,
String remoteFileName,
File targetFile)
throws IOException
IOException
public void downloadFile(String remoteDir,
String remoteFileName,
File targetFile,
Monitor monitor)
throws IOException
IOExceptionDownloader
public void download(String remoteDir,
String remoteFileName,
OutputStream target)
throws IOException
IOException
public void download(String remoteDir,
String remoteFileName,
OutputStream target,
Monitor monitor)
throws IOException
IOException
public Object[] downloadTree(String remoteSourceDir,
File targetDir)
throws IOException
IOException
public Object[] downloadTree(String remoteSourceDir,
File targetDir,
Logger logger)
throws IOException
IOException(String, File)
public Object[] downloadTree(String remoteSourceDir,
File targetDir,
Logger logger,
Monitor monitor)
throws IOException
IOException(String, File, Logger)
public Object[] synchronizeDirectory(File sourceDir,
String remoteTargetDir,
boolean deleteRemoteFiles)
throws IOException
IllegalArgumentException - if the sourceDir is not a directory
IOException
public Object[] synchronizeDirectory(File sourceDir,
String remoteTargetDir,
boolean deleteRemoteFiles,
Logger logger)
throws IOException
This method allows e.g. GUIs to display status messages by implementing a
special LogWriter.
The given logger may be null, otherwise its usage is as follows:
IOExceptionsynchronizeDirectory(File, String, boolean)
public Object[] synchronizeDirectory(File sourceDir,
String remoteTargetDir,
boolean deleteRemoteFiles,
Logger logger,
Monitor monitor)
throws IOException
This method allows monitoring threads to abort the synchronization by disabling the given monitor during processing. The monitor/logger may be null; monitor checks occur for each directory and after each copy operation.
IOExceptionsynchronizeDirectory(File, String, boolean, Logger)
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||