public class FtpTransfer extends java.lang.Object implements FileTransfer
// create new FtpTransfer instance
FileTransfer ftp = new FtpTransfer("ftp.myserver.com","anonymous","user@myserver.com");
try {
// connect to FTP server
ftp.connect();
<p/>
// print out directory listing
System.out.println(ftp.getDirListingAsString());
<p/>
// disconnect from FTP server
ftp.disconnect();
} catch(Exception e) {
System.out.println(e);
}
ASCII, AUTO, BINARY, CURRENT_DIRECTORY, PARENT_DIRECTORY| Constructor and Description |
|---|
FtpTransfer()
Creates FtpTransfer instance.
|
FtpTransfer(java.lang.String host,
int port,
java.lang.String user,
java.lang.String password,
java.io.File localDirectory,
java.util.Set<FileTransferListener> listeners) |
FtpTransfer(java.lang.String host,
java.lang.String user,
java.lang.String pwd)
Creates FtpTransfer instance.
|
FtpTransfer(java.lang.String host,
java.lang.String user,
java.lang.String pwd,
java.io.File localDirectory)
Creates FtpTransfer instance.
|
FtpTransfer(java.lang.String host,
java.lang.String user,
java.lang.String pwd,
int port)
Creates FtpTransfer instance.
|
FtpTransfer(java.lang.String host,
java.lang.String user,
java.lang.String pwd,
java.lang.Integer port)
Creates FtpTransfer instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
abortDownloadThread(java.lang.String remoteFile)
Abort download thread.
|
void |
abortDownloadThreads()
Abort all download threads.
|
void |
abortUploadThread(java.lang.String remoteFile)
Abort upload thread.
|
void |
abortUploadThreads()
Abort all upload threads.
|
void |
addFileTransferListener(FileTransferListener listener)
See FileTransfer interface for method description.
|
void |
changePassword(java.lang.String oldPassword,
java.lang.String newPassword)
Changes the password.
|
void |
checksum(java.io.File localFile,
java.lang.String remoteFile) |
void |
clearProxySettings()
Clears proxy server values.
|
void |
close() |
FtpTransfer |
connect()
Connects to server and performs login.
|
void |
connect(boolean login)
Establishes a connection with FTP server with optional login
|
FileTransfer |
copy()
Returns a copy of current transfer instance with same listeners.
|
void |
deleteDir(java.lang.String name)
See FileTransfer interface for method description.
|
void |
deleteDir(java.lang.String name,
boolean recursive)
See FileTransfer interface for method description.
|
void |
deleteFile(java.lang.String remoteFile)
See FileTransfer interface for method description.
|
void |
disconnect()
See FileTransfer interface for method description.
|
void |
download(java.io.OutputStream out,
java.lang.String remoteFile)
See FileTransfer interface for method description.
|
java.io.File |
download(java.lang.String remoteFile)
See FileTransfer interface for method description.
|
java.io.File |
download(java.lang.String localFile,
java.lang.String remoteFile)
See FileTransfer interface for method description.
|
void |
downloadDir(java.lang.String remoteDir)
See FileTransfer interface for method description.
|
void |
downloadDir(java.lang.String remoteDir,
int retryLimit,
boolean performChecksum)
Downloads remote directory and contents.
|
void |
downloadDir(java.lang.String remoteDir,
int retryLimit,
boolean performChecksum,
int threadCount)
Downloads remote directory and contents.
|
boolean |
exists(java.lang.String path)
Checks if the specified path exists on the remote server.
|
int |
getBlockTransferSize()
Gets blocksize for use in transferring files.
|
boolean |
getDebug()
See FileTransfer interface for method description.
|
java.io.PrintStream |
getDebugStream()
See FileTransfer interface for method description.
|
java.lang.String |
getDir()
See FileTransfer interface for method description.
|
java.util.Enumeration<FileTransferRemoteFile> |
getDirListing()
See FileTransfer interface for method description.
|
java.util.Enumeration<FileTransferRemoteFile> |
getDirListing(java.lang.String filter)
See FileTransfer interface for method description.
|
java.lang.String |
getDirListingAsString()
See FileTransfer interface for method description.
|
java.lang.String |
getDirListingAsString(java.lang.String filter)
See FileTransfer interface for method description.
|
boolean |
getErrorOnSizeCommand()
Gets the error on size command indicator.
|
long |
getFilesize(java.lang.String remoteFile)
See FileTransfer interface for method description.
|
java.util.Date |
getFileTimestamp(java.lang.String remoteFile)
See FileTransfer interface for method description.
|
java.lang.String |
getHostname()
See FileTransfer interface for method description.
|
java.lang.Object |
getImplementation()
See FileTransfer interface for method description.
|
java.io.InputStream |
getInputStream(java.lang.String remoteFile,
long pos)
See FileTransfer interface for method description.
|
java.lang.String |
getLocalChecksum(java.io.File localFile)
Returns local checksum.
|
java.io.File |
getLocalDir()
See FileTransfer interface for method description.
|
java.util.Enumeration |
getLocalDirListing()
See FileTransfer interface for method description.
|
int |
getMode()
See FileTransfer interface for method description.
|
java.util.Enumeration |
getNameListing()
See FileTransfer interface for method description.
|
java.util.Enumeration |
getNameListing(java.lang.String filter)
See FileTransfer interface for method description.
|
java.io.OutputStream |
getOutputStream(java.lang.String fileName,
long off)
See FileTransfer interface for method description.
|
boolean |
getPassive()
See FileTransfer interface for method description.
|
java.lang.String |
getPassword()
See FileTransfer interface for method description.
|
boolean |
getPerformMLSDListing()
Get MLSD directory listing.
|
int |
getPort()
See FileTransfer interface for method description.
|
int |
getRecursiveDirectoryFileCount(java.lang.String directory)
Get recursive directory file count.
|
long |
getRecursiveDirectorySize(java.lang.String directory)
Get recursive directory size.
|
java.lang.String |
getRemoteFileChecksum(java.lang.String remoteFile)
Returns remote file checksum.
|
java.util.Vector<FileTransferRemoteFile> |
getRemoteFileList(java.lang.String remoteDirectory)
Get remote directory list.
|
boolean |
getTcpNoDelay() |
long |
getTimeout()
See FileTransfer interface for method description.
|
boolean |
getUseEPSV()
Gets use EPSV value.
|
java.lang.String |
getUsername()
See FileTransfer interface for method description.
|
java.lang.String |
getWireEncoding()
Gets encoding set used when issuing commands and transferring files
|
void |
interrupt()
See FileTransfer interface for method description.
|
boolean |
interrupted()
See FileTransfer interface for method description.
|
boolean |
isChecksumVerificationRequired() |
boolean |
isConnected()
See FileTransfer interface for method description.
|
boolean |
isDirectory(java.lang.String remotePath) |
boolean |
isFeatureSupported(java.lang.String command) |
void |
issueCommand(java.lang.String command)
Issues command to the server.
|
void |
login()
Logs into FTP server after establishing a connection.
|
void |
makeDir(java.lang.String name)
See FileTransfer interface for method description.
|
void |
makeDirRecursive(java.lang.String name)
See FileTransfer interface for method description.
|
java.io.File |
makeLocalDir(java.lang.String name)
See FileTransfer interface for method description.
|
void |
mdelete(java.lang.String filter)
Deletes multiple files matching filter to FTP server's current directory.
|
void |
mdownload(java.util.Enumeration fileNames)
See FileTransfer interface for method description.
|
void |
mdownload(java.lang.String filter)
See FileTransfer interface for method description.
|
void |
mupload(java.util.Enumeration fileNames)
See FileTransfer interface for method description.
|
void |
mupload(java.lang.String filter)
See FileTransfer interface for method description.
|
void |
removeFileTransferListener(FileTransferListener listener)
See FileTransfer interface for method description.
|
void |
renameFile(java.lang.String remoteFile,
java.lang.String newFile)
See FileTransfer interface for method description.
|
void |
reset()
See FileTransfer interface for method description.
|
void |
resumeDownload(java.io.OutputStream out,
java.lang.String remoteFile,
long remoteFileOffset) |
void |
resumeDownload(java.lang.String remoteFile,
long offset)
See FileTransfer interface for method description.
|
void |
resumeDownload(java.lang.String localFile,
java.lang.String remoteFile,
long offset)
See FileTransfer interface for method description.
|
void |
resumeUpload(java.io.File file,
long offset)
See FileTransfer interface for method description.
|
void |
resumeUpload(java.io.File localFile,
java.lang.String remoteFile,
long localFileOffset)
Resume upload of file to server.
|
void |
resumeUpload(java.io.InputStream in,
long length,
java.lang.String remoteFile,
long remoteFileOffset) |
void |
resumeUpload(java.lang.String file,
long offset)
See FileTransfer interface for method description.
|
boolean |
sameChecksum(java.io.File localFile,
java.lang.String remoteFile)
Checks a checksum equality of local and remote files.
|
FileTransfer |
setAscii()
See FileTransfer interface for method description.
|
FileTransfer |
setAuto(boolean auto)
See FileTransfer interface for method description.
|
FtpTransfer |
setAutoDetectIpv6(boolean autoDetect)
Set auto detect Ipv6.
|
FileTransfer |
setBinary()
See FileTransfer interface for method description.
|
FileTransfer |
setBlockTransferSize(int blocksize)
Sets block size for use in transferring files.
|
FileTransfer |
setChecksumVerificationRequired(boolean value) |
FtpTransfer |
setCompression(boolean compression)
Sets whether the data will be compressed during the transfering.
|
FtpTransfer |
setConnectBeforeCommand(boolean before)
Sets the connectBefore property value
|
FileTransfer |
setDebug(boolean debug)
See FileTransfer interface for method description.
|
FileTransfer |
setDebugStream(java.io.PrintStream ps)
See FileTransfer interface for method description.
|
FileTransfer |
setDir(java.lang.String name)
See FileTransfer interface for method description.
|
FileTransfer |
setDirUp()
See FileTransfer interface for method description.
|
FtpTransfer |
setErrorOnSizeCommand(boolean error)
Sets the indicator value which will be used by methods that invokes
getFileSize.
|
FileTransfer |
setFileModificationTime(java.lang.String remoteFile,
java.util.Date dateFile)
Set modification time.
|
FileTransfer |
setFileTimestamp(java.lang.String remoteFile,
java.util.Date timestamp)
See FileTransfer interface for method description.
|
FileTransfer |
setHostname(java.lang.String host)
See FileTransfer interface for method description.
|
FileTransfer |
setLocalDir(java.io.File dir)
See FileTransfer interface for method description.
|
FtpTransfer |
setNATAddress(java.lang.String ipAddress)
Sets a NAT address which will be used after PASV command.
|
FileTransfer |
setPassive(boolean passive)
See FileTransfer interface for method description.
|
FileTransfer |
setPassword(java.lang.String password)
See FileTransfer interface for method description.
|
FtpTransfer |
setPerformMLSDListing(boolean mlsdListing)
Set MLSD directory listing.
|
FileTransfer |
setPort(int port)
See FileTransfer interface for method description.
|
FileTransfer |
setPreserveFileDownloadTimestamp(boolean value)
Set preserve file download timestamps.
|
FileTransfer |
setPreserveFileUploadTimestamp(boolean value)
Get preserve file upload timestamps.
|
FileTransfer |
setProxyAuthentication(java.lang.String proxyUsername,
java.lang.String proxyPassword)
Sets the proxy authentication username and password to use with
proxy server.
|
FileTransfer |
setProxyHost(java.lang.String proxyHostname,
int proxyPort)
Sets the proxy hostname and port for this connection.
|
FileTransfer |
setProxyType(java.lang.String proxyType)
Sets the proxy type will be used for this connection.
|
FtpTransfer |
setTcpNoDelay(boolean value) |
FileTransfer |
setTimeout(long timeout)
See FileTransfer interface for method description.
|
FileTransfer |
setTimeZone(java.util.TimeZone timeZone)
Set the timezone, used for preserving timestamps.
|
FtpTransfer |
setUseEPRT(boolean useEPRT)
Sets use EPRT indicator.
|
FtpTransfer |
setUseEPSV(boolean useEPSV)
Sets use EPSV indicator.
|
void |
setUseExtendedDirectoryListing(boolean useExtendedDirectoryListing)
Sets the use extended directory listing field.
|
FileTransfer |
setUsername(java.lang.String username)
See FileTransfer interface for method description.
|
FileTransfer |
setWireEncoding(java.lang.String encoding)
Sets encoding set used when issuing commands and transferring files.
|
void |
upload(byte[] data,
java.lang.String name)
See FileTransfer interface for method description.
|
void |
upload(byte[] data,
java.lang.String name,
boolean append)
See FileTransfer interface for method description.
|
void |
upload(java.io.File file)
See FileTransfer interface for method description.
|
void |
upload(java.io.File file,
boolean append)
See FileTransfer interface for method description.
|
void |
upload(java.io.File file,
java.lang.String remoteName)
See FileTransfer interface for method description.
|
void |
upload(java.io.File file,
java.lang.String remoteName,
boolean append)
See FileTransfer interface for method description.
|
void |
upload(java.io.InputStream in,
long length,
java.lang.String remoteFile,
boolean shouldAppend) |
void |
upload(java.lang.String name)
See FileTransfer interface for method description.
|
void |
upload(java.lang.String name,
boolean append)
See FileTransfer interface for method description.
|
void |
upload(java.lang.String extension,
java.io.File file)
Uploads a file to server with the extension specified by the argument.
|
void |
upload(java.lang.String name,
java.lang.String remoteName)
See FileTransfer interface for method description.
|
void |
upload(java.lang.String name,
java.lang.String remoteName,
boolean append)
See FileTransfer interface for method description.
|
void |
uploadDir(java.io.File localDir)
See FileTransfer interface for method description.
|
void |
uploadDir(java.io.File localDir,
int retryLimit,
boolean performChecksum,
java.lang.String extension)
Uploads local directory and contents.
|
void |
uploadDir(java.io.File localDir,
int retryLimit,
boolean performChecksum,
java.lang.String extension,
int threadCount)
Uploads local directory and contents.
|
void |
uploadDir(java.io.File localDir,
int retryLimit,
int retryInterval,
boolean performChecksum,
java.lang.String extension)
Uploads local directory and contents.
|
void |
uploadDir(java.io.File localDir,
java.lang.String extension)
Uploads local directory and contents recursively to server.
|
java.lang.String |
uploadUnique(java.io.File file)
See FileTransfer interface for method description.
|
java.lang.String |
uploadUnique(java.io.InputStream in,
java.lang.String remoteFilePrefix)
See FileTransfer interface for method description.
|
java.lang.String |
uploadUnique(java.lang.String fileName)
See FileTransfer interface for method description.
|
public FtpTransfer(java.lang.String host,
int port,
java.lang.String user,
java.lang.String password,
java.io.File localDirectory,
java.util.Set<FileTransferListener> listeners)
public FtpTransfer(java.lang.String host,
java.lang.String user,
java.lang.String pwd,
java.io.File localDirectory)
host - the hostname of FTP serveruser - the username of FTP userpwd - the password of FTP userlocalDirectory - the local directory to be used for uploading / downloading
filespublic FtpTransfer(java.lang.String host,
java.lang.String user,
java.lang.String pwd,
int port)
host - the hostname of FTP serveruser - the username of FTP userpwd - the password of FTP userport - the port of FTP serverpublic FtpTransfer(java.lang.String host,
java.lang.String user,
java.lang.String pwd,
java.lang.Integer port)
host - the hostname of FTP serveruser - the username of FTP userpwd - the password of FTP userport - the port of FTP serverpublic FtpTransfer(java.lang.String host,
java.lang.String user,
java.lang.String pwd)
host - the hostname of FTP serveruser - the username of FTP userpwd - the password of FTP userpublic FtpTransfer()
public FtpTransfer connect() throws FileTransferException
FileTransferconnect in interface FileTransferFileTransferException - FileTransferException instanceFileTransfer.setUsername(java.lang.String),
FileTransfer.setPassword(java.lang.String)public void connect(boolean login)
throws FileTransferException
login - true to login, false otherwiseFileTransferExceptionpublic void login()
throws FileTransferException
FileTransferException - if an I/O or protocol error occurspublic FileTransfer setPreserveFileUploadTimestamp(boolean value)
FileTransfersetPreserveFileUploadTimestamp in interface FileTransferpublic FileTransfer setPreserveFileDownloadTimestamp(boolean value)
FileTransfersetPreserveFileDownloadTimestamp in interface FileTransferpublic boolean isChecksumVerificationRequired()
isChecksumVerificationRequired in interface FileTransferpublic FileTransfer setChecksumVerificationRequired(boolean value)
setChecksumVerificationRequired in interface FileTransferpublic FileTransfer setTimeZone(java.util.TimeZone timeZone)
FileTransfersetTimeZone in interface FileTransferpublic void issueCommand(java.lang.String command)
throws FileTransferException
command - a commandFileTransferException - if an error occurspublic void changePassword(java.lang.String oldPassword,
java.lang.String newPassword)
throws FileTransferException
oldPassword - the old password.newPassword - the new password.FileTransferException - if I/O or protocol error occurs.public void deleteDir(java.lang.String name)
throws FileTransferException
deleteDir in interface FileTransfername - the directory to removeFileTransferException - if an I/O or server error occurs.FileTransfer.deleteDir(String)public void deleteDir(java.lang.String name,
boolean recursive)
throws FileTransferException
deleteDir in interface FileTransfername - the directory to removerecursive - true if it should delete files and subdirectories within directoryFileTransferException - if an I/O or server error occurs.FileTransfer.deleteDir(String, boolean)public boolean exists(java.lang.String path)
throws FileTransferException
FileTransferexists in interface FileTransferpath - a path to verifytrue if path exists; false otherwiseFileTransferException - if an error occurspublic void deleteFile(java.lang.String remoteFile)
throws FileTransferException
deleteFile in interface FileTransferremoteFile - name of file to deleteFileTransferException - if an I/O or server error occurs.FileTransfer.deleteFile(String)public void disconnect()
throws FileTransferException
disconnect in interface FileTransferFileTransferException - if an I/O or server error occurs.FileTransfer.disconnect()public void close()
close in interface FileTransferclose in interface java.lang.AutoCloseablepublic void download(java.io.OutputStream out,
java.lang.String remoteFile)
throws FileTransferException
download in interface FileTransferout - the OutputStream to write download toremoteFile - remote filenameFileTransferException - if an I/O or server error occurs.FileTransfer.download(OutputStream, String)public java.io.File download(java.lang.String remoteFile)
throws FileTransferException
download in interface FileTransferremoteFile - the file to downloadFileTransferException - if an I/O or server error occurs.FileTransfer.download(String)public java.io.File download(java.lang.String localFile,
java.lang.String remoteFile)
throws FileTransferException
download in interface FileTransferlocalFile - destination filenameremoteFile - remote filenameFileTransferException - if an I/O or server error occurs.FileTransfer.download(String, String)public void downloadDir(java.lang.String remoteDir)
throws FileTransferException
downloadDir in interface FileTransferremoteDir - the directory to downloadFileTransferException - if an I/O or server error occurs.FileTransfer.downloadDir(String)public void downloadDir(java.lang.String remoteDir,
int retryLimit,
boolean performChecksum)
throws FileTransferException
downloadDir in interface FileTransferremoteDir - the directory to downloadretryLimit - Retry number when an error occursperformChecksum - Checksum perform indicatorFtpException - if an I/O or protocol error occurs.FileTransferException - if an I/O or protocol error occurs.public boolean getDebug()
getDebug in interface FileTransfertrue if debugging is onFileTransfer.getDebug()public java.io.PrintStream getDebugStream()
getDebugStream in interface FileTransferPrintStream used in reporting debug statementsFileTransfer.getDebugStream()public java.lang.String getDir()
throws FileTransferException
getDir in interface FileTransferFileTransferException - if an I/O or server error occurs.FileTransfer.getDir()public boolean getPerformMLSDListing()
public FtpTransfer setPerformMLSDListing(boolean mlsdListing)
mlsdListing - - boolean valuepublic java.util.Enumeration<FileTransferRemoteFile> getDirListing() throws FileTransferException
getDirListing in interface FileTransferEnumeration of FileTransferRemoteFile objectsFileTransferException - if an I/O or server error occurs.FileTransfer.getDirListing()public java.util.Enumeration<FileTransferRemoteFile> getDirListing(java.lang.String filter) throws FileTransferException
getDirListing in interface FileTransferfilter - the filename filterEnumeration of FileTransferRemoteFile objectsFileTransferException - if an I/O or server error occurs.FileTransfer.getDirListing(String)public java.lang.String getDirListingAsString()
throws FileTransferException
getDirListingAsString in interface FileTransferFileTransferException - if an I/O or server error occurs.FileTransfer.getDirListingAsString()public java.lang.String getDirListingAsString(java.lang.String filter)
throws FileTransferException
getDirListingAsString in interface FileTransferfilter - a filename filterFileTransferException - if an I/O or server error occurs.FileTransfer.getDirListingAsString(String)public boolean isDirectory(java.lang.String remotePath)
throws FileTransferException
isDirectory in interface FileTransferFileTransferExceptionpublic long getFilesize(java.lang.String remoteFile)
throws FileTransferException
getFilesize in interface FileTransferremoteFile - the remote fileFileTransferException - if an I/O or protocol error occurs.FileTransfer.getFilesize(String)public java.util.Date getFileTimestamp(java.lang.String remoteFile)
throws FileTransferException
getFileTimestamp in interface FileTransferremoteFile - the remote fileFileTransferException - if an I/O or server error occurs.FileTransfer.getFileTimestamp(String)public FileTransfer setFileTimestamp(java.lang.String remoteFile, java.util.Date timestamp) throws FileTransferException
setFileTimestamp in interface FileTransferremoteFile - the remote filetimestamp - the new date/timestampFileTransferException - if an I/O or server error occurs.FileTransfer.setFileTimestamp(String, Date)public FileTransfer setFileModificationTime(java.lang.String remoteFile, java.util.Date dateFile) throws FileTransferException
setFileModificationTime in interface FileTransferremoteFile - - the remote file.dateFile - - the time.FileTransferExceptionpublic boolean sameChecksum(java.io.File localFile,
java.lang.String remoteFile)
throws FileTransferException
FileTransfersameChecksum in interface FileTransferlocalFile - a local fileremoteFile - a remote filetrue if checksums are equal; false otherwiseFileTransferException - if an error occurspublic java.lang.String getHostname()
getHostname in interface FileTransferFileTransfer.getHostname()public java.io.File getLocalDir()
getLocalDir in interface FileTransferFileTransfer.getLocalDir()public java.util.Enumeration getLocalDirListing()
getLocalDirListing in interface FileTransferjava.util.Enumeration of FileFileTransfer.getLocalDirListing()public int getMode()
getMode in interface FileTransferFileTransfer.getMode()public java.util.Enumeration getNameListing()
throws FileTransferException
getNameListing in interface FileTransferEnumeration of String where each item represents a file
or directory nameFileTransferException - if an I/O or server related error occursFileTransfer.getNameListing()public java.util.Enumeration getNameListing(java.lang.String filter)
throws FileTransferException
getNameListing in interface FileTransferfilter - the filename filterEnumeration of String where each item represents a file
or directory nameFileTransferException - if an I/O or server related error occursFileTransfer.getNameListing(String)public boolean getPassive()
getPassive in interface FileTransfertrue if passive mode is used, false otherwiseFileTransfer.getPassive()public java.lang.String getPassword()
getPassword in interface FileTransferFileTransfer.getPassword()public int getPort()
getPort in interface FileTransferFileTransfer.getPort()public long getTimeout()
getTimeout in interface FileTransferFileTransfer.getTimeout()public java.lang.String getUsername()
getUsername in interface FileTransferFileTransfer.getUsername()public void interrupt()
interrupt in interface FileTransferFileTransfer.interrupt()public boolean interrupted()
interrupted in interface FileTransfertrue if transfer process was interrupted.FileTransfer.interrupted()public boolean isConnected()
isConnected in interface FileTransfertrue if connected false otherwiseFileTransfer.isConnected()public void makeDir(java.lang.String name)
throws FileTransferException
makeDir in interface FileTransfername - name of directory to makeFileTransferException - if an I/O or server error occurs.FileTransfer.makeDir(String)public void makeDirRecursive(java.lang.String name)
throws FileTransferException
makeDirRecursive in interface FileTransfername - full path of directory to makeFileTransferException - if an I/O or server error occursFileTransfer.makeDirRecursive(String)public void mdelete(java.lang.String filter)
throws FileTransferException
mdelete in interface FileTransferfilter - the regular expression filter to useFileTransferException - if an I/O or protocol error occurs.public java.io.File makeLocalDir(java.lang.String name)
makeLocalDir in interface FileTransfername - name of directoryFileTransfer.makeLocalDir(String)public void mdownload(java.util.Enumeration fileNames)
throws FileTransferException
mdownload in interface FileTransferfileNames - filenames of files to downloadFileTransferException - if an I/O or server error occurs.FileTransfer.mdownload(Enumeration)public void mdownload(java.lang.String filter)
throws FileTransferException
mdownload in interface FileTransferfilter - the regular expression to useFileTransferException - if an I/O or server error occurs.FileTransfer.mdownload(String)public void mupload(java.util.Enumeration fileNames)
throws FileTransferException
mupload in interface FileTransferfileNames - filenames of files to uploadFileTransferException - if an I/O or server error occurs.FileTransfer.mupload(Enumeration)public void mupload(java.lang.String filter)
throws FileTransferException
mupload in interface FileTransferfilter - the regular expression to useFileTransferException - if an I/O or server error occurs.FileTransfer.mupload(String)public void renameFile(java.lang.String remoteFile,
java.lang.String newFile)
throws FileTransferException
renameFile in interface FileTransferremoteFile - name of file to renamenewFile - new name of fileFileTransferException - if an I/O or server error occurs.FileTransfer.renameFile(String, String)public void reset()
reset in interface FileTransferFileTransfer.reset()public void resumeDownload(java.lang.String remoteFile,
long offset)
throws FileTransferException
resumeDownload in interface FileTransferremoteFile - the file to downloadoffset - file offset in bytesFileTransferException - if an I/O or server error occurs.FileTransfer.resumeDownload(String, long)public void resumeDownload(java.lang.String localFile,
java.lang.String remoteFile,
long offset)
throws FileTransferException
resumeDownload in interface FileTransferlocalFile - local file nameremoteFile - the file to downloadoffset - file offset in bytesFileTransferException - if an I/O or server error occurs.FileTransfer.resumeDownload(String, String, long)public void resumeUpload(java.io.File file,
long offset)
throws FileTransferException
resumeUpload in interface FileTransferfile - the local file to uploadoffset - file offset in bytesFileTransferException - if an I/O or server error occurs.FileTransfer.resumeUpload(File, long)public void resumeUpload(java.lang.String file,
long offset)
throws FileTransferException
resumeUpload in interface FileTransferfile - the local file to uploadoffset - file offset in bytesFileTransferException - if an I/O or server error occurs.FileTransfer.resumeUpload(String, long)public FileTransfer setAscii()
setAscii in interface FileTransferFileTransfer.setAscii()public FileTransfer setAuto(boolean auto)
setAuto in interface FileTransferauto - true to turn automatic detect on false to turn offFileTransfer.setAuto(boolean)public FileTransfer setBinary()
setBinary in interface FileTransferFileTransfer.setBinary()public FileTransfer setDebug(boolean debug)
setDebug in interface FileTransferdebug - true to turn debugging onFileTransfer.setDebug(boolean)public FileTransfer setDebugStream(java.io.PrintStream ps)
setDebugStream in interface FileTransferps - the PrintStream to send debug statements toFileTransfer.setDebugStream(PrintStream)public FileTransfer setDir(java.lang.String name) throws FileTransferException
setDir in interface FileTransfername - the remote directoryFileTransferException - if an I/O or server error occurs.FileTransfer.setDir(String)public FileTransfer setDirUp() throws FileTransferException
setDirUp in interface FileTransferFileTransferException - if an I/O or server error occurs.FileTransfer.setDirUp()public FileTransfer setHostname(java.lang.String host)
setHostname in interface FileTransferhost - the hostname or IP address of serverFileTransfer.setHostname(String)public boolean getTcpNoDelay()
public FtpTransfer setTcpNoDelay(boolean value)
public FileTransfer setLocalDir(java.io.File dir)
setLocalDir in interface FileTransferdir - the local directoryFileTransfer.setLocalDir(File)public FtpTransfer setErrorOnSizeCommand(boolean error)
error - Error indicator valuepublic boolean getErrorOnSizeCommand()
true then method which invokes getFileSize will throw
an exception when it caused an error, false the error will be ignored.public FtpTransfer setNATAddress(java.lang.String ipAddress) throws FileTransferException
ipAddress - The NAT IP address.FtpException - If an error occurs.FileTransferExceptionpublic FileTransfer setPassive(boolean passive)
setPassive in interface FileTransferpassive - if true, the transfers will be passive.FileTransfer.setPassive(boolean)public FileTransfer setPassword(java.lang.String password)
setPassword in interface FileTransferpassword - the passwordFileTransfer.setPassword(String)public FileTransfer setProxyAuthentication(java.lang.String proxyUsername, java.lang.String proxyPassword)
setProxyAuthentication in interface FileTransferproxyUsername - the proxy usernameproxyPassword - the proxy passwordclearProxySettings()public FileTransfer setProxyHost(java.lang.String proxyHostname, int proxyPort)
setProxyHost in interface FileTransferproxyHostname - the hostname or ip address of the proxy serverproxyPort - the port of the proxy server to connect toclearProxySettings()public FileTransfer setProxyType(java.lang.String proxyType)
setProxyType in interface FileTransferproxyType - The proxy type. Values allowed: HTTP, SOCKS5public void clearProxySettings()
clearProxySettings in interface FileTransferpublic FileTransfer setTimeout(long timeout)
setTimeout in interface FileTransfertimeout - the timeout in millisecondsFileTransfer.setTimeout(long)public FileTransfer setUsername(java.lang.String username)
setUsername in interface FileTransferusername - the usernameFileTransfer.setUsername(String)public FtpTransfer setUseEPSV(boolean useEPSV)
useEPSV - The use EPSV valuepublic FtpTransfer setAutoDetectIpv6(boolean autoDetect)
autoDetect - public FtpTransfer setUseEPRT(boolean useEPRT)
useEPRT - public void setUseExtendedDirectoryListing(boolean useExtendedDirectoryListing)
useExtendedDirectoryListing - The use extended directory listing indicator.public boolean getUseEPSV()
true the pasive mode will be sent EPSV commandpublic FileTransfer setWireEncoding(java.lang.String encoding)
setWireEncoding in interface FileTransferencoding - the character encoding to be usedpublic FtpTransfer setConnectBeforeCommand(boolean before)
before - It indicates if the connection will be established before send
the command in passive modepublic java.lang.String getWireEncoding()
getWireEncoding in interface FileTransferpublic java.lang.String getRemoteFileChecksum(java.lang.String remoteFile)
throws FtpException
remoteFile - remote fileFtpException - if an error occurspublic java.lang.String getLocalChecksum(java.io.File localFile)
throws FtpException
localFile - File which will be calculate the checksumFtpException - if an error occurspublic void upload(byte[] data,
java.lang.String name)
throws FileTransferException
upload in interface FileTransferdata - the raw contents of the file to uploadname - the filename to store file as on FTP serverFileTransferException - if an I/O or server related error occursFileTransfer.upload(byte[], String)public void upload(byte[] data,
java.lang.String name,
boolean append)
throws FileTransferException
upload in interface FileTransferdata - the raw contents of the file to uploadname - the filename to store file as on serverappend - true to append to remote file on FTP server, false otherwiseFileTransferException - if an I/O or server related error occursFileTransfer.upload(byte[], String, boolean)public void upload(java.io.File file)
throws FileTransferException
upload in interface FileTransferfile - the local file to uploadFileTransferException - if an I/O or server related error occursFileTransfer.upload(File)public void upload(java.io.File file,
boolean append)
throws FileTransferException
upload in interface FileTransferfile - the local file to uploadappend - true to append to remote file on server, false otherwiseFileTransferException - if an I/O or server related error occursFileTransfer.upload(File, boolean)public void upload(java.lang.String extension,
java.io.File file)
throws FileTransferException
upload in interface FileTransferextension - The extension file will be used to upload the file.file - The file will be uploadedFileTransferExceptionpublic void upload(java.io.File file,
java.lang.String remoteName)
throws FileTransferException
upload in interface FileTransferfile - the local file to uploadremoteName - the destination filename of uploadFileTransferException - if an I/O or server related error occursFileTransfer.upload(File, String)public void upload(java.io.File file,
java.lang.String remoteName,
boolean append)
throws FileTransferException
upload in interface FileTransferfile - the local file to uploadremoteName - the destination filename of uploadappend - true to append to remote file on server, false otherwiseFileTransferException - if an I/O or server related error occursFileTransfer.upload(File, String, boolean)public void upload(java.lang.String name)
throws FileTransferException
upload in interface FileTransfername - the local file to uploadFileTransferException - if an I/O or server error occurs.FileTransfer.upload(String)public void upload(java.lang.String name,
boolean append)
throws FileTransferException
upload in interface FileTransfername - the local file to uploadappend - true to append to remote file on server, false otherwiseFileTransferException - if an I/O or server error occurs.FileTransfer.upload(String, boolean)public void upload(java.lang.String name,
java.lang.String remoteName)
throws FileTransferException
upload in interface FileTransfername - the local file to uploadremoteName - the destination of uploadFileTransferException - if an I/O or server error occurs.FileTransfer.upload(String, String)public void upload(java.lang.String name,
java.lang.String remoteName,
boolean append)
throws FileTransferException
upload in interface FileTransfername - the local file to uploadremoteName - the destination of uploadappend - true to append to remote file on FTP server, false otherwiseFileTransferException - if an I/O or server error occurs.FileTransfer.upload(String, String, boolean)public java.lang.String uploadUnique(java.lang.String fileName)
throws FileTransferException
uploadUnique in interface FileTransferfileName - the file to be uploaded relative to current local directoryFileTransferException - if an I/O or protocol error occurs.FileTransfer.uploadUnique(String)public java.lang.String uploadUnique(java.io.File file)
throws FileTransferException
uploadUnique in interface FileTransferfile - the file to be uploadedFileTransferException - if an I/O or protocol error occurs.FileTransfer.uploadUnique(File)public java.lang.String uploadUnique(java.io.InputStream in,
java.lang.String remoteFilePrefix)
throws FileTransferException
uploadUnique in interface FileTransferin - the InputStream to upload file fromremoteFilePrefix - the filename to be used as seed value for determining unique filenameFileTransferException - if an I/O or protocol error occurs.FileTransfer.uploadUnique(InputStream, String)public void uploadDir(java.io.File localDir)
throws FileTransferException
uploadDir in interface FileTransferlocalDir - the directory to uploadFileTransferException - if an I/O or protocol error occurs.FileTransfer.uploadDir(File)public void uploadDir(java.io.File localDir,
java.lang.String extension)
throws FileTransferException
uploadDir in interface FileTransferlocalDir - the directory to uploadextension - The extension file name used to upload each fileFileTransferException - if an I/O or protocol error occurs.public void uploadDir(java.io.File localDir,
int retryLimit,
boolean performChecksum,
java.lang.String extension)
throws FileTransferException
uploadDir in interface FileTransferlocalDir - the directory to uploadretryLimit - Retry number when an error occursperformChecksum - Checksum perform indicatorextension - The extension which will be used to upload the filesFtpException - if an I/O or protocol error occurs.FileTransferException - if an I/O or protocol related error occurs.public void uploadDir(java.io.File localDir,
int retryLimit,
int retryInterval,
boolean performChecksum,
java.lang.String extension)
throws FileTransferException
localDir - the directory to uploadretryLimit - Retry number when an error occursretryInterval - the retry interval in secondsperformChecksum - Checksum perform indicatorextension - The extension which will be used to upload the filesFtpException - if an I/O or protocol error occurs.FileTransferExceptionpublic void addFileTransferListener(FileTransferListener listener)
addFileTransferListener in interface FileTransferlistener - the listener to addFileTransfer.addFileTransferListener(FileTransferListener)public void removeFileTransferListener(FileTransferListener listener)
removeFileTransferListener in interface FileTransferlistener - the listener to removeFileTransfer.removeFileTransferListener(FileTransferListener)public java.io.InputStream getInputStream(java.lang.String remoteFile,
long pos)
throws FileTransferException
getInputStream in interface FileTransferremoteFile - the remote file to get InputStream forpos - the byte offset, 0 to get full fileInputStreamFileTransferException - if an I/O or protocol related error occurspublic java.lang.Object getImplementation()
getImplementation in interface FileTransferFtp,
Ftpspublic java.io.OutputStream getOutputStream(java.lang.String fileName,
long off)
throws FileTransferException
getOutputStream in interface FileTransferfileName - the remote filenameoff - the byte offset, 0 to write at beginning of fileOutputStreamFileTransferException - if an I/O or protocol related error occurspublic FileTransfer copy()
FileTransfercopy in interface FileTransferpublic FileTransfer setBlockTransferSize(int blocksize)
setBlockTransferSize in interface FileTransferblocksize - the blocksize in bytespublic int getBlockTransferSize()
getBlockTransferSize in interface FileTransferpublic FtpTransfer setCompression(boolean compression)
compression - When it is true the data will be compressed before it is
sent between the client and the server.public FileTransfer setPort(int port)
setPort in interface FileTransferport - the portFileTransfer.setPort(int)public boolean isFeatureSupported(java.lang.String command)
throws FileTransferException
FileTransferExceptionpublic void checksum(java.io.File localFile,
java.lang.String remoteFile)
throws FileTransferException
FileTransferExceptionpublic void abortDownloadThreads()
FileTransferabortDownloadThreads in interface FileTransferpublic void abortDownloadThread(java.lang.String remoteFile)
FileTransferabortDownloadThread in interface FileTransferpublic void abortUploadThread(java.lang.String remoteFile)
FileTransferabortUploadThread in interface FileTransferpublic void abortUploadThreads()
FileTransferabortUploadThreads in interface FileTransferpublic void downloadDir(java.lang.String remoteDir,
int retryLimit,
boolean performChecksum,
int threadCount)
throws FileTransferException
FileTransferdownloadDir in interface FileTransferremoteDir - the directory to downloadretryLimit - retry limit if download failsperformChecksum - whether or not to perform checksum after download, only supported in FTP/S protocols and not by all FTP serversthreadCount - the thread countFileTransferException - if an I/O or protocol error occurs.public java.util.Vector<FileTransferRemoteFile> getRemoteFileList(java.lang.String remoteDirectory) throws FileTransferException
FileTransfergetRemoteFileList in interface FileTransferFileTransferExceptionpublic int getRecursiveDirectoryFileCount(java.lang.String directory)
FileTransfergetRecursiveDirectoryFileCount in interface FileTransferpublic long getRecursiveDirectorySize(java.lang.String directory)
FileTransfergetRecursiveDirectorySize in interface FileTransferpublic void uploadDir(java.io.File localDir,
int retryLimit,
boolean performChecksum,
java.lang.String extension,
int threadCount)
throws FileTransferException
FileTransferuploadDir in interface FileTransferlocalDir - the directory to uploadretryLimit - retry number when an error occursperformChecksum - whether or not to perform checksum verificationextension - the temporary extension which will be used when uploading files or null to use current extensionFileTransferException - if an I/O or protocol related error occurs.public void resumeUpload(java.io.File localFile,
java.lang.String remoteFile,
long localFileOffset)
throws FileTransferException
FileTransferresumeUpload in interface FileTransferFileTransferExceptionpublic void resumeDownload(java.io.OutputStream out,
java.lang.String remoteFile,
long remoteFileOffset)
throws FileTransferException
resumeDownload in interface FileTransferFileTransferExceptionpublic void upload(java.io.InputStream in,
long length,
java.lang.String remoteFile,
boolean shouldAppend)
throws FileTransferException
upload in interface FileTransferFileTransferExceptionpublic void resumeUpload(java.io.InputStream in,
long length,
java.lang.String remoteFile,
long remoteFileOffset)
throws FileTransferException
resumeUpload in interface FileTransferFileTransferExceptionCopyright © JSCAPE LLC. 1999-2021. All Rights Reserved