public interface FileTransfer
extends java.lang.AutoCloseable
FileTransfer ftp = new FtpFileTransfer(hostname,username,password); ftp.connect(); System.out.println(ftp.getDirListingAsString()); ftp.disconnect();
Modifier and Type | Field and Description |
---|---|
static int |
ASCII
Flag to indicate that ASCII transfer mode is used.
|
static int |
AUTO
Flag to indicate that automatic transfer mode detection is used.
|
static int |
BINARY
Flag to indicate that BINARY transfer mode is used.
|
static java.lang.String |
CURRENT_DIRECTORY
Represents the current directory.
|
static java.lang.String |
PARENT_DIRECTORY
Represents the parent directory of current directory.
|
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)
Adds FileTransferListener.
|
void |
clearProxySettings()
Clears proxy server values.
|
void |
close() |
FileTransfer |
connect()
Connects to server and performs login.
|
FileTransfer |
copy()
Returns a copy of current transfer instance with same listeners.
|
void |
deleteDir(java.lang.String remoteDirectory)
Deletes directory from server.
|
void |
deleteDir(java.lang.String remoteDirectory,
boolean recursive)
Deletes directory from server.
|
void |
deleteFile(java.lang.String remoteFile)
Deletes remote file from server.
|
void |
disconnect()
Quits session and disconnects from server.
|
void |
download(java.io.OutputStream out,
java.lang.String remoteFile)
Downloads file from server and writes contents to provided
OutputStream . |
java.io.File |
download(java.lang.String remoteFile)
Downloads file from server.
|
java.io.File |
download(java.lang.String localFile,
java.lang.String remoteFile)
Downloads file from server.
|
void |
downloadDir(java.lang.String remoteDirectory)
Downloads remote directory and contents recursively from server.
|
void |
downloadDir(java.lang.String remoteDirectory,
int retryAttempts,
boolean checksumVerificationRequired)
Downloads remote directory and contents.
|
void |
downloadDir(java.lang.String remoteDirectory,
int retryAttempts,
boolean checksumVerificationRequired,
int threadCount)
Downloads remote directory and contents.
|
boolean |
exists(java.lang.String remotePath)
Checks if the specified path exists on the remote server.
|
int |
getBlockTransferSize()
Gets blocksize for use in transferring files.
|
boolean |
getDebug()
Gets debugging state.
|
java.io.PrintStream |
getDebugStream()
Gets PrintStream used in reporting debug statements.
|
java.lang.String |
getDir()
Gets current working directory of server.
|
java.util.Enumeration<FileTransferRemoteFile> |
getDirListing()
Gets directory listing from server.
|
java.util.Enumeration<FileTransferRemoteFile> |
getDirListing(java.lang.String regex)
Gets file listing of files matching regular expression.
|
java.lang.String |
getDirListingAsString()
Gets directory listing of files on server.
|
java.lang.String |
getDirListingAsString(java.lang.String regex)
Gets file listing of files matching regular expression.
|
long |
getFilesize(java.lang.String remoteFile)
Gets filesize of remote file from server.
|
java.util.Date |
getFileTimestamp(java.lang.String remoteFile)
Gets date/timestamp of remote file from server.
|
java.lang.String |
getHostname()
Gets hostname of server.
|
java.lang.Object |
getImplementation()
Gets underlying file transfer instance.
|
java.io.InputStream |
getInputStream(java.lang.String remoteFile,
long remoteFileOffset)
Gets
InputStream for remote file for reading. |
java.io.File |
getLocalDir()
Gets local directory to be used in session.
|
java.util.Enumeration |
getLocalDirListing()
Gets local directory listing.
|
int |
getMode()
Gets data transfer mode for current session.
|
java.util.Enumeration |
getNameListing()
Gets directory listing of files on server.
|
java.util.Enumeration |
getNameListing(java.lang.String regex)
Gets directory listing of files on server matching regular expression.
|
java.io.OutputStream |
getOutputStream(java.lang.String remoteFile,
long remoteFileOffset)
Gets
OutputStream for writing to remote file. |
boolean |
getPassive()
Gets whether passive mode is used for FTP connections.
|
java.lang.String |
getPassword()
Gets password.
|
int |
getPort()
Gets server port.
|
int |
getRecursiveDirectoryFileCount(java.lang.String remoteDirectory)
Get recursive directory file count.
|
long |
getRecursiveDirectorySize(java.lang.String remoteDirectory)
Get recursive directory size.
|
java.util.Vector<FileTransferRemoteFile> |
getRemoteFileList(java.lang.String remoteDirectory)
Get remote directory list.
|
long |
getTimeout()
Gets the timeout for opening connection to server.
|
java.lang.String |
getUsername()
Gets username.
|
java.lang.String |
getWireEncoding()
Gets encoding set used when issuing commands and transferring files.
|
void |
interrupt()
Interrupts the current data transfer and sets interrupted flag to
true . |
boolean |
interrupted()
Checks if transfer process was interrupted.
|
boolean |
isChecksumVerificationRequired() |
boolean |
isConnected()
Checks if client is connected to server.
|
boolean |
isDirectory(java.lang.String remotePath) |
void |
makeDir(java.lang.String remoteDirectory)
Makes directory on server.
|
void |
makeDirRecursive(java.lang.String remoteDirectory)
Makes directory on server, creating subdirectories if necessary.
|
java.io.File |
makeLocalDir(java.lang.String localDirectory)
Creates local directory.
|
void |
mdelete(java.lang.String regex)
Deletes multiple files in servers current directory matching regular expression.
|
void |
mdownload(java.util.Enumeration remoteFiles)
Downloads specified files in current working remote directory from server
to local directory.
|
void |
mdownload(java.lang.String regex)
Downloads multiple files matching regular expression from server's current
directory.
|
void |
mupload(java.util.Enumeration localFiles)
Uploads multiple files to server.
|
void |
mupload(java.lang.String regex)
Uploads multiple files matching regular expression to server's current directory.
|
void |
removeFileTransferListener(FileTransferListener listener)
Removes specified FileTransferListener.
|
void |
renameFile(java.lang.String sourceRemoteFile,
java.lang.String destinationRemoteFile)
Renames remote file on server.
|
void |
reset()
Resets the interrupted flag to
false . |
void |
resumeDownload(java.io.OutputStream out,
java.lang.String remoteFile,
long remoteFileOffset) |
void |
resumeDownload(java.lang.String remoteFile,
long remoteFileOffset)
Resumes download of file from server.
|
void |
resumeDownload(java.lang.String localFile,
java.lang.String remoteFile,
long remoteFileOffset)
Resumes download of file from server.
|
void |
resumeUpload(java.io.File localFile,
long localFileOffset)
Resumes upload of file to server.
|
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 localFile,
long localFileOffset)
Resumes upload of file to server.
|
boolean |
sameChecksum(java.io.File localFile,
java.lang.String remoteFile)
Checks a checksum equality of local and remote files.
|
FileTransfer |
setAscii()
Sets data transfer mode to ASCII.
|
FileTransfer |
setAuto(boolean value)
Sets data transfer mode to automatically detect transfer mode.
|
FileTransfer |
setBinary()
Sets data transfer mode to binary.
|
FileTransfer |
setBlockTransferSize(int value)
Sets block size for use in transferring files.
|
FileTransfer |
setChecksumVerificationRequired(boolean value) |
FileTransfer |
setDebug(boolean debug)
Sets debugging state.
|
FileTransfer |
setDebugStream(java.io.PrintStream ps)
Sets
PrintStream used in reporting debug statements. |
FileTransfer |
setDir(java.lang.String remoteDirectory)
Sets current directory on server.
|
FileTransfer |
setDirUp()
Sets current directory on server to parent directory.
|
FileTransfer |
setFileModificationTime(java.lang.String remoteFile,
java.util.Date modificationTime)
Set file modifcation time.
|
FileTransfer |
setFileTimestamp(java.lang.String remoteFile,
java.util.Date timestamp)
Sets date/timestamp of remote file from server
When using the FTP/S protocols the MDTM command is used.
|
FileTransfer |
setHostname(java.lang.String value)
Sets hostname of server.
|
FileTransfer |
setLocalDir(java.io.File value)
Sets local directory to be used in session.
|
FileTransfer |
setPassive(boolean value)
Sets whether passive mode is used for FTP connections.
|
FileTransfer |
setPassword(java.lang.String value)
Sets password.
|
FileTransfer |
setPort(int value)
Sets port of remote server.
|
FileTransfer |
setPreserveFileDownloadTimestamp(boolean value)
Set preserve file download timestamps.
|
FileTransfer |
setPreserveFileUploadTimestamp(boolean value)
Get preserve file upload timestamps.
|
FileTransfer |
setProxyAuthentication(java.lang.String username,
java.lang.String password)
Sets the proxy authentication username and password to use with
proxy server.
|
FileTransfer |
setProxyHost(java.lang.String host,
int port)
Sets the proxy hostname and port for this connection.
|
FileTransfer |
setProxyType(java.lang.String value)
Sets the proxy type will be used for this connection.
|
FileTransfer |
setTimeout(long value)
Sets the timeout for opening connection to server.
|
FileTransfer |
setTimeZone(java.util.TimeZone value)
Set the timezone, used for preserving timestamps.
|
FileTransfer |
setUsername(java.lang.String value)
Sets username.
|
FileTransfer |
setWireEncoding(java.lang.String value)
Sets encoding set used when issuing commands and transferring files.
|
void |
upload(byte[] data,
java.lang.String remoteFile)
Uploads file to server where contents of file is not on disk but
in memory.
|
void |
upload(byte[] data,
java.lang.String remoteFile,
boolean shouldAppend)
Uploads file to server where contents of file is not on disk but
in memory.
|
void |
upload(java.io.File localFile)
Uploads file to server.
|
void |
upload(java.io.File localFile,
boolean shouldAppend)
Uploads file to server.
|
void |
upload(java.io.File localFile,
java.lang.String remoteFile)
Uploads file to server.
|
void |
upload(java.io.File localFile,
java.lang.String remoteFile,
boolean shouldAppend)
Uploads file to server.
|
void |
upload(java.io.InputStream in,
long length,
java.lang.String remoteFile,
boolean shouldAppend) |
void |
upload(java.lang.String localFile)
Uploads file to server.
|
void |
upload(java.lang.String localFile,
boolean shouldAppend)
Uploads file to server.
|
void |
upload(java.lang.String tempFileExtension,
java.io.File localFile)
Uploads file to server with the specified temporary extension.
|
void |
upload(java.lang.String localFile,
java.lang.String remoteFile)
Uploads file to server.
|
void |
upload(java.lang.String localFile,
java.lang.String remoteFile,
boolean shouldAppend)
Uploads file to server.
|
void |
uploadDir(java.io.File localDirectory)
Uploads local directory and contents recursively to server.
|
void |
uploadDir(java.io.File localDirectory,
int retryAttempts,
boolean checksumVerificationRequired,
java.lang.String tempFileExtension)
Uploads local directory and contents.
|
void |
uploadDir(java.io.File localDirectory,
int retryAttempts,
boolean checksumVerificationRequired,
java.lang.String tempFileExtension,
int threadCount)
Uploads local directory and contents.
|
void |
uploadDir(java.io.File localDirectory,
java.lang.String tempFileExtension)
Uploads local directory and contents recursively to server.
|
java.lang.String |
uploadUnique(java.io.File localFile)
Uploads the file which is created in the current directory under a name unique to that directory.
|
java.lang.String |
uploadUnique(java.io.InputStream in,
java.lang.String remoteFilePrefix)
Uploads the file which is created in the current directory under a name unique to that directory.
|
java.lang.String |
uploadUnique(java.lang.String localFile)
Uploads the file which is created in the current directory under a name unique to that directory.
|
static final int AUTO
getMode()
,
Constant Field Valuesstatic final int ASCII
getMode()
,
Constant Field Valuesstatic final int BINARY
getMode()
,
Constant Field Valuesstatic final java.lang.String CURRENT_DIRECTORY
static final java.lang.String PARENT_DIRECTORY
FileTransfer setProxyType(java.lang.String value)
value
- The proxy type. Values allowed: HTTP, SOCKS5FileTransfer setProxyHost(java.lang.String host, int port)
host
- the hostname or ip address of the proxy serverport
- the port of the proxy server to connect toclearProxySettings()
FileTransfer setProxyAuthentication(java.lang.String username, java.lang.String password)
username
- the proxy usernamepassword
- the proxy passwordclearProxySettings()
void clearProxySettings()
java.lang.String getHostname()
FileTransfer setHostname(java.lang.String value)
value
- the hostname or IP address of serverint getPort()
FileTransfer setPort(int value)
value
- the portlong getTimeout()
FileTransfer setTimeout(long value)
value
- the timeout in millisecondsjava.lang.String getUsername()
FileTransfer setUsername(java.lang.String value)
value
- the usernamejava.lang.String getPassword()
FileTransfer setPassword(java.lang.String value)
value
- the passwordint getBlockTransferSize()
FileTransfer setBlockTransferSize(int value)
value
- the blocksize in bytesboolean getPassive()
true
if passive mode is used, false
otherwiseFileTransfer setPassive(boolean value)
value
- if true, the transfers will be passive.int getMode()
FileTransfer setAscii()
FileTransferException
- if an I/O or server error occurs.FileTransfer setAuto(boolean value)
value
- true
to turn automatic detect on false
to turn offFileTransferException
- if an I/O or server error occurs.FileTransfer setBinary()
FileTransferException
- if an I/O or server error occurs.java.lang.String getWireEncoding()
FileTransfer setWireEncoding(java.lang.String value)
value
- the character encoding to be usedFileTransfer setPreserveFileUploadTimestamp(boolean value)
value
- FileTransfer setPreserveFileDownloadTimestamp(boolean value)
value
- boolean isChecksumVerificationRequired()
FileTransfer setChecksumVerificationRequired(boolean value)
FileTransfer setTimeZone(java.util.TimeZone value)
value
- boolean getDebug()
true
if debugging is onFileTransfer setDebug(boolean debug)
System.out
.debug
- true
to turn debugging onsetDebugStream(java.io.PrintStream)
java.io.PrintStream getDebugStream()
PrintStream
is System.out
.PrintStream
used in reporting debug statementsPrintStream
FileTransfer setDebugStream(java.io.PrintStream ps)
PrintStream
used in reporting debug statements.
Default debug stream is System.out
.ps
- the PrintStream
to send debug statements toPrintStream
void addFileTransferListener(FileTransferListener listener)
listener
- the listener to addFileTransferListener
void removeFileTransferListener(FileTransferListener listener)
listener
- the listener to removeFileTransferListener
java.io.File getLocalDir()
FileTransfer setLocalDir(java.io.File value)
value
- the local directoryjava.util.Enumeration getLocalDirListing()
java.util.Enumeration
of File
java.io.File makeLocalDir(java.lang.String localDirectory) throws FileTransferException
localDirectory
- name of directoryFileTransferException
getLocalDir()
java.lang.Object getImplementation()
FileTransfer copy()
FileTransfer connect() throws FileTransferException
FileTransferException
- if an I/O or server error occurs.setUsername(java.lang.String)
,
setPassword(java.lang.String)
void disconnect() throws FileTransferException
FileTransferException
- if an I/O or server error occurs.void close()
close
in interface java.lang.AutoCloseable
boolean isConnected()
true
if connected false
otherwisejava.lang.String getDir() throws FileTransferException
FileTransferException
- if an I/O or server error occurs.FileTransfer setDir(java.lang.String remoteDirectory) throws FileTransferException
remoteDirectory
- the remote directoryFileTransferException
- if an I/O or server error occurs.FileTransfer setDirUp() throws FileTransferException
FileTransferException
- if an I/O or server error occurs.java.util.Enumeration<FileTransferRemoteFile> getDirListing(java.lang.String regex) throws FileTransferException
regex
- the filename filterEnumeration
of FileTransferRemoteFile
objectsFileTransferException
- if an I/O or server error occurs.getDirListingAsString(String)
,
getNameListing(java.lang.String)
java.util.Enumeration<FileTransferRemoteFile> getDirListing() throws FileTransferException
Enumeration
of FileTransferRemoteFile
objectsFileTransferException
- if an I/O or server error occurs.getDirListingAsString(String)
,
getNameListing(java.lang.String)
java.lang.String getDirListingAsString(java.lang.String regex) throws FileTransferException
regex
- a filename filterFileTransferException
- if an I/O or server error occurs.java.lang.String getDirListingAsString() throws FileTransferException
FileTransferException
- if an I/O or server error occurs.java.util.Enumeration getNameListing(java.lang.String regex) throws FileTransferException
regex
- the filename filterEnumeration
of String
where each item represents a file
or directory nameFileTransferException
- if an I/O or server related error occursjava.util.Enumeration getNameListing() throws FileTransferException
Enumeration
of String
where each item represents a file
or directory nameFileTransferException
- if an I/O or server related error occursjava.util.Vector<FileTransferRemoteFile> getRemoteFileList(java.lang.String remoteDirectory) throws FileTransferException
remoteDirectory
- FileTransferException
long getRecursiveDirectorySize(java.lang.String remoteDirectory) throws FileTransferException
remoteDirectory
- FileTransferException
int getRecursiveDirectoryFileCount(java.lang.String remoteDirectory) throws FileTransferException
remoteDirectory
- FileTransferException
void makeDir(java.lang.String remoteDirectory) throws FileTransferException
remoteDirectory
- name of directory to makeFileTransferException
- if an I/O or server error occurs.void makeDirRecursive(java.lang.String remoteDirectory) throws FileTransferException
remoteDirectory
- full path of directory to makeFileTransferException
- if an I/O or server error occursvoid deleteDir(java.lang.String remoteDirectory) throws FileTransferException
remoteDirectory
- the directory to removeFileTransferException
- if an I/O or server error occurs.void deleteDir(java.lang.String remoteDirectory, boolean recursive) throws FileTransferException
recursive
parameter will be used to determine if files and subdirectories within
directory should be removed.remoteDirectory
- the directory to removerecursive
- true
if it should delete files and subdirectories within directoryFileTransferException
- if an I/O or server error occurs.boolean exists(java.lang.String remotePath) throws FileTransferException
remotePath
- a path to verifytrue
if path exists; false
otherwiseFileTransferException
- if an error occursboolean isDirectory(java.lang.String remotePath) throws FileTransferException
FileTransferException
long getFilesize(java.lang.String remoteFile) throws FileTransferException
remoteFile
- the remote fileFileTransferException
- if an I/O or protocol error occurs.java.util.Date getFileTimestamp(java.lang.String remoteFile) throws FileTransferException
remoteFile
- the remote fileFileTransferException
- if an I/O or server error occurs.FileTransfer setFileTimestamp(java.lang.String remoteFile, java.util.Date timestamp) throws FileTransferException
remoteFile
- the remote filetimestamp
- the new date/timestampFileTransferException
- if an I/O or server error occurs.FileTransfer setFileModificationTime(java.lang.String remoteFile, java.util.Date modificationTime) throws FileTransferException
remoteFile
- - the remote file.modificationTime
- - the time.FileTransferException
boolean sameChecksum(java.io.File localFile, java.lang.String remoteFile) throws FileTransferException
localFile
- a local fileremoteFile
- a remote filetrue
if checksums are equal; false
otherwiseFileTransferException
- if an error occursvoid renameFile(java.lang.String sourceRemoteFile, java.lang.String destinationRemoteFile) throws FileTransferException
sourceRemoteFile
- name of file to renamedestinationRemoteFile
- new name of fileFileTransferException
- if an I/O or server error occurs.void deleteFile(java.lang.String remoteFile) throws FileTransferException
remoteFile
- name of file to deleteFileTransferException
- if an I/O or server error occurs.void mdelete(java.lang.String regex) throws FileTransferException
regex
- the regular expression filter to useFileTransferException
- if an error occurs.void download(java.io.OutputStream out, java.lang.String remoteFile) throws FileTransferException
OutputStream
.
Closure of OutputStream
is responsibility of programmer.out
- the OutputStream to write download toremoteFile
- remote filenameFileTransferException
- if an I/O or server error occurs.java.io.File download(java.lang.String localFile, java.lang.String remoteFile) throws FileTransferException
localFile
- destination filenameremoteFile
- remote filenameFileTransferException
- if an I/O or server error occurs.setLocalDir(java.io.File)
java.io.File download(java.lang.String remoteFile) throws FileTransferException
remoteFile
- the file to downloadFileTransferException
- if an I/O or server error occurs.setLocalDir(java.io.File)
void resumeDownload(java.io.OutputStream out, java.lang.String remoteFile, long remoteFileOffset) throws FileTransferException
FileTransferException
void resumeDownload(java.lang.String localFile, java.lang.String remoteFile, long remoteFileOffset) throws FileTransferException
localFile
- local file nameremoteFile
- the file to downloadremoteFileOffset
- file offset in bytesFileTransferException
- if an I/O or server error occurs.void resumeDownload(java.lang.String remoteFile, long remoteFileOffset) throws FileTransferException
remoteFile
- the file to downloadremoteFileOffset
- file offset in bytesFileTransferException
- if an I/O or server error occurs.void mdownload(java.util.Enumeration remoteFiles) throws FileTransferException
downloadDir(String)
method.
Downloads are stored relative to current local directory.remoteFiles
- filenames of files to downloadFileTransferException
- if an I/O or server error occurs.setLocalDir(java.io.File)
,
downloadDir(String)
void mdownload(java.lang.String regex) throws FileTransferException
downloadDir
method.regex
- the regular expression to useFileTransferException
- if an I/O or server error occurs.setLocalDir(java.io.File)
,
downloadDir(java.lang.String, int, boolean, int)
void downloadDir(java.lang.String remoteDirectory, int retryAttempts, boolean checksumVerificationRequired, int threadCount) throws FileTransferException
remoteDirectory
- the directory to downloadretryAttempts
- retry limit if download failschecksumVerificationRequired
- 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.void downloadDir(java.lang.String remoteDirectory, int retryAttempts, boolean checksumVerificationRequired) throws FileTransferException
remoteDirectory
- the directory to downloadretryAttempts
- retry limit if download failschecksumVerificationRequired
- whether or not to perform checksum after download, only supported in FTP/S protocols and not by all FTP serversFileTransferException
- if an I/O or protocol error occurs.void downloadDir(java.lang.String remoteDirectory) throws FileTransferException
remoteDirectory
- the directory to downloadFileTransferException
- if an I/O or server error occurs.setLocalDir(java.io.File)
void upload(java.io.InputStream in, long length, java.lang.String remoteFile, boolean shouldAppend) throws FileTransferException
FileTransferException
void upload(byte[] data, java.lang.String remoteFile, boolean shouldAppend) throws FileTransferException
data
- the raw contents of the file to uploadremoteFile
- the filename to store file as on servershouldAppend
- true
to append to remote file on FTP server, false
otherwiseFileTransferException
- if an I/O or server related error occursvoid upload(byte[] data, java.lang.String remoteFile) throws FileTransferException
data
- the raw contents of the file to uploadremoteFile
- the filename to store file as on FTP serverFileTransferException
- if an I/O or server related error occursvoid upload(java.io.File localFile, java.lang.String remoteFile, boolean shouldAppend) throws FileTransferException
file
is a directory then directory and entire contents are uploaded.localFile
- the local file to uploadremoteFile
- the destination filename of uploadshouldAppend
- true
to append to remote file on server, false
otherwiseFileTransferException
- if an I/O or server related error occursvoid upload(java.io.File localFile, java.lang.String remoteFile) throws FileTransferException
file
is a directory then directory and entire contents are uploaded.localFile
- the local file to uploadremoteFile
- the destination filename of uploadFileTransferException
- if an I/O or server related error occursvoid upload(java.io.File localFile, boolean shouldAppend) throws FileTransferException
file
is a directory then directory and entire contents are uploaded.localFile
- the local file to uploadshouldAppend
- true
to append to remote file on server, false
otherwiseFileTransferException
- if an I/O or server related error occursvoid upload(java.lang.String tempFileExtension, java.io.File localFile) throws FileTransferException
tempFileExtension
- the temporary extension to use when uploading the filelocalFile
- the file to be uploadedFileTransferException
- if an I/O or protocol error occursvoid upload(java.io.File localFile) throws FileTransferException
file
is a directory then directory and entire contents are uploaded.localFile
- the local file to uploadFileTransferException
- if an I/O or server related error occursvoid upload(java.lang.String localFile, java.lang.String remoteFile, boolean shouldAppend) throws FileTransferException
localFile
- the local file to uploadremoteFile
- the destination of uploadshouldAppend
- true
to append to remote file on FTP server, false
otherwiseFileTransferException
- if an I/O or server error occurs.setLocalDir(java.io.File)
void upload(java.lang.String localFile, java.lang.String remoteFile) throws FileTransferException
localFile
- the local file to uploadremoteFile
- the destination of uploadFileTransferException
- if an I/O or server error occurs.setLocalDir(java.io.File)
void upload(java.lang.String localFile, boolean shouldAppend) throws FileTransferException
localFile
- the local file to uploadshouldAppend
- true
to append to remote file on server, false
otherwiseFileTransferException
- if an I/O or server error occurs.setLocalDir(java.io.File)
void upload(java.lang.String localFile) throws FileTransferException
localFile
- the local file to uploadFileTransferException
- if an I/O or server error occurs.setLocalDir(java.io.File)
void resumeUpload(java.io.InputStream in, long length, java.lang.String remoteFile, long remoteFileOffset) throws FileTransferException
FileTransferException
void resumeUpload(java.io.File localFile, java.lang.String remoteFile, long localFileOffset) throws FileTransferException
localFile
- remoteFile
- localFileOffset
- FileTransferException
void resumeUpload(java.io.File localFile, long localFileOffset) throws FileTransferException
localFile
- the local file to uploadlocalFileOffset
- file offset in bytesFileTransferException
- if an I/O or server error occurs.void resumeUpload(java.lang.String localFile, long localFileOffset) throws FileTransferException
localFile
- the local file to uploadlocalFileOffset
- file offset in bytesFileTransferException
- if an I/O or server error occurs.java.lang.String uploadUnique(java.io.InputStream in, java.lang.String remoteFilePrefix) throws FileTransferException
in
- 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.java.lang.String uploadUnique(java.io.File localFile) throws FileTransferException
localFile
- the file to be uploadedFileTransferException
- if an I/O or protocol error occurs.java.lang.String uploadUnique(java.lang.String localFile) throws FileTransferException
localFile
- the file to be uploaded relative to current local directoryFileTransferException
- if an I/O or protocol error occurs.setLocalDir(File)
void mupload(java.util.Enumeration localFiles) throws FileTransferException
localFiles
- filenames of files to uploadFileTransferException
- if an I/O or server error occurs.setLocalDir(java.io.File)
void mupload(java.lang.String regex) throws FileTransferException
regex
- the regular expression to useFileTransferException
- if an I/O or server error occurs.setLocalDir(java.io.File)
void uploadDir(java.io.File localDirectory, int retryAttempts, boolean checksumVerificationRequired, java.lang.String tempFileExtension, int threadCount) throws FileTransferException
localDirectory
- the directory to uploadretryAttempts
- retry number when an error occurschecksumVerificationRequired
- whether or not to perform checksum verificationtempFileExtension
- the temporary extension which will be used when uploading files or null
to use current extensionthreadCount
- FileTransferException
- if an I/O or protocol related error occurs.void uploadDir(java.io.File localDirectory, int retryAttempts, boolean checksumVerificationRequired, java.lang.String tempFileExtension) throws FileTransferException
localDirectory
- the directory to uploadretryAttempts
- retry number when an error occurschecksumVerificationRequired
- whether or not to perform checksum verificationtempFileExtension
- 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.void uploadDir(java.io.File localDirectory, java.lang.String tempFileExtension) throws FileTransferException
localDirectory
- the directory to uploadtempFileExtension
- The extension file name used to upload each fileFileTransferException
- if an I/O or protocol error occurs.void uploadDir(java.io.File localDirectory) throws FileTransferException
localDirectory
- the directory to uploadFileTransferException
- if an I/O or protocol error occurs.java.io.InputStream getInputStream(java.lang.String remoteFile, long remoteFileOffset) throws FileTransferException
InputStream
for remote file for reading.remoteFile
- the remote file to get InputStream
forremoteFileOffset
- the byte offset, 0 to get full fileInputStream
FileTransferException
- if an I/O or protocol related error occursjava.io.OutputStream getOutputStream(java.lang.String remoteFile, long remoteFileOffset) throws FileTransferException
OutputStream
for writing to remote file.remoteFile
- the remote filenameremoteFileOffset
- the byte offset, 0 to write at beginning of fileOutputStream
FileTransferException
- if an I/O or protocol related error occursvoid interrupt()
true
.
After invoking this method you must reset the interrupted flag to false
.
before transferring any files.reset()
boolean interrupted()
true
if transfer process was interrupted.void reset()
false
.
This method should be invoked if you have interrupted a transfer using the
interrupt
method and wish to resume transfering files.interrupt()
void abortUploadThreads()
void abortUploadThread(java.lang.String remoteFile)
remoteFile
- void abortDownloadThread(java.lang.String remoteFile)
remoteFile
- void abortDownloadThreads()
Copyright © JSCAPE LLC. 1999-2021. All Rights Reserved