|
Secure FTP Factory | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jscape.inet.sftp.Sftp
public class Sftp
Implements the basic functionality of a SFTP (FTP over SSH) client.
Example usage:
// connection information String hostname = "10.0.0.1"; String username = "jsmith"; String password = "secret"; // create com.jscape.inet.ssh.util.SshParameters instance SshParameters params = new SshParameters(hostname,username,password); // create Sftp instance Sftp sftp = new Sftp(params); // connect to SSH server sftp.connect(); // print directory listing to console System.out.println(sftp.getDirListingAsString()); // disconnect from SSH server sftp.disconnect();
Field Summary | |
---|---|
static int |
ADAPTIVE_BLOCK_SIZE
Adaptive block transfer size. |
static int |
ASCII
|
static int |
AUTO
|
static int |
BINARY
|
Constructor Summary | |
---|---|
Sftp(SshParameters params)
Creates a new client instance. |
|
Sftp(SshParameters params,
java.io.File localDir)
Creates a new client instance. |
|
Sftp(SshParameters params,
java.io.File localDir,
SftpConfiguration config)
Creates a new client instance. |
|
Sftp(SshParameters params,
SftpConfiguration config)
Creates a new client instance. |
Method Summary | |
---|---|
void |
abortDownloadThreads()
Abort download threads. |
void |
abortUploadThreads()
Abort all upload threads. |
void |
addSftpListener(SftpListener listener)
Adds event listener. |
static void |
clearProxySettings()
Clears proxy server values. |
void |
connect()
Establishes secure connection with SSH server. |
void |
deleteDir(java.lang.String remoteDirectory)
Deletes directory from SSH server. |
void |
deleteDir(java.lang.String remoteDirectory,
boolean recurse)
Deletes directory from SSH server recursively. |
void |
deleteFile(java.lang.String remoteFile)
Deletes file from SSH server. |
void |
disableFileAccessLogging()
Turn off file access logging. |
void |
disconnect()
Disconnects from the remote host. |
void |
download(java.io.OutputStream out,
java.lang.String remoteFile)
Downloads file from SSH server and writes to specified OutputStream . |
void |
download(java.io.OutputStream out,
java.lang.String remoteFile,
long off)
Downloads file from SSH server and writes to specified OutputStream . |
java.io.File |
download(java.lang.String remoteFile)
Downloads file from SSH server. |
java.io.File |
download(java.lang.String localFile,
java.lang.String remoteFile)
Downloads the file from SSH server. |
void |
downloadDir(java.lang.String remoteDirectory)
Downloads remote directory and contents recursively from SSH server. |
void |
downloadDir(java.lang.String remoteDir,
int retryLimit)
Downloads remote directory and contents from SSH server. |
void |
downloadDir(java.lang.String remoteDir,
int retryLimit,
int retryInterval)
Downloads remote directory and contents from SSH server. |
void |
downloadDir(java.lang.String remoteDir,
int retryLimit,
int retryInterval,
int threadCount)
Downloads remote directory and contents from SSH server. |
void |
enableFileAccessLogging()
Turn on file access logging. |
int |
getBlockSize()
Gets upload block size. |
java.io.PrintStream |
getDebugStream()
Gets PrintStream used in reporting debugging statements. |
java.lang.String |
getDir()
Gets current working directory of SSH server. |
java.util.Enumeration |
getDirListing()
Gets directory listing from SSH server. |
java.util.Enumeration |
getDirListing(java.lang.String regex)
Gets directory listing from SSH server where file names matches the regular expression. |
java.lang.String |
getDirListingAsString()
Gets directory listing of files on SSH server. |
java.lang.String |
getDirListingAsString(java.lang.String regex)
Gets directory listing from SSH server where file names matches the regular expression. |
int |
getDownloadBlockSize()
Gets the current download buffer size. |
int |
getFilePermissions(java.lang.String remoteFile)
Gets remote file permissions in UNIX chmod format (644, 777). |
long |
getFilesize(java.lang.String remoteFile)
Gets filesize of remote file from SSH server. |
java.util.Date |
getFileTimestamp(java.lang.String remoteFile)
Gets date/timestamp of remote file from SSH server. |
SshHostKeys |
getHostKeys()
Gets SSH host keys for further use. |
java.io.InputStream |
getInputStream(java.lang.String filename,
long offset)
Gets an InputStream from SSH server for the purposes of downloading a file. |
java.lang.String |
getLineTerminator()
Gets destination line terminator used in ASCII file transfers. |
java.io.File |
getLocalDir()
Gets local directory to be used in SSH session. |
java.util.Enumeration |
getLocalDirListing()
Gets local directory listing. |
java.util.Enumeration |
getLocalDirListing(java.lang.String regex)
Gets local directory listing. |
int |
getMode()
Gets data transfer mode for current session. |
java.util.Enumeration |
getNameListing()
Gets directory listing of files on SSH server. |
java.util.Enumeration |
getNameListing(java.lang.String regex)
Gets the remote directory content names. |
java.io.OutputStream |
getOutputStream(java.lang.String filename,
long offset,
boolean append)
Gets an OutputStream from SSH server for the purposes of uploading a file. |
java.lang.String |
getRealPath(java.lang.String path)
Gets real server path. |
int |
getRecursiveDirectoryFileCount(java.lang.String directory)
Get size of all files rescursively in a given remote directory. |
long |
getRecursiveDirectorySize(java.lang.String directory)
Get size of all files rescursively in a given remote directory. |
java.util.Vector |
getRemoteFileList(java.lang.String remoteDir)
Gets a remote file list fron the current directory. |
long |
getTimeout()
Gets the current connection timeout value. |
int |
getUploadBlockSize()
Gets the current upload buffer size. |
void |
interrupt()
Interrupts the current data transfer and sets interrupted flag to true . |
boolean |
interrupted()
Checks if transfer process was interrupted. |
boolean |
isConnected()
Tests whether the current service is connected to the remote host. |
boolean |
isDirectory(java.lang.String remotePath)
Checks if remote pathname denotes a directory. |
boolean |
isValidPath(java.lang.String path)
Checks if path is valid, i.e. |
void |
makeDir(java.lang.String newDirectory)
Makes directory on SSH server. |
void |
makeDirRecursive(java.lang.String newDirectory)
Makes directory on SSH server, creating subdirectories if necessary. |
java.io.File |
makeLocalDir(java.lang.String directoryName)
Creates local directory. |
void |
mdelete(java.lang.String regex)
Deletes multiple files matching regular expression from SSH server's current directory. |
void |
mdownload(java.util.Enumeration fileNames)
Downloads specified files in current working remote directory from SSH server to local directory. |
void |
mdownload(java.lang.String regex)
Downloads multiple files matching filter from SSH server's current directory. |
void |
mupload(java.util.Enumeration fileNames)
Uploads multiple files to SSH server. |
void |
mupload(java.lang.String regex)
Uploads multiple files matching filter to SSH server's current directory. |
void |
removeSftpListener(SftpListener listener)
Removes specified SSH event listener. |
void |
renameFile(java.lang.String remoteFile,
java.lang.String newFile)
Renames remote file on SSH server. |
void |
reset()
Resets the interrupted flag to false . |
java.io.File |
resumeDownload(java.lang.String remoteFile,
long off)
Resumes download of file from SSH server. |
java.io.File |
resumeDownload(java.lang.String localFile,
java.lang.String remoteFile,
long off)
Resumes download of file from SSH server. |
void |
resumeUpload(java.io.File localFile,
long off)
Resumes upload of file to SSH server. |
void |
resumeUpload(java.io.File localFile,
java.lang.String remoteFile,
long off)
Resumes upload of file to SSH server. |
void |
resumeUpload(java.lang.String localFile,
long off)
Resumes upload of file to SSH server. |
void |
resumeUpload(java.lang.String localFile,
java.lang.String remoteFile,
long off)
Resumes upload of file to SSH server. |
void |
setAscii()
Sets data transfer mode to ASCII. |
void |
setAuto(boolean auto)
Sets data transfer mode to automatic detect Any files with a base Content-Type value of text will be transferred using ASCII, all other files will be transfered using binary. |
void |
setBinary()
Sets data transfer mode to binary. |
void |
setBlockSize(int blockSize)
Deprecated. see #setUploadBlockSize |
void |
setDebug(boolean debug)
Sets debugging state. |
void |
setDebugStream(java.io.PrintStream debugStream)
Sets PrintStream used in reporting debugging statements. |
void |
setDir(java.lang.String remoteDirectory)
Sets current directory on SSH server. |
void |
setDirUp()
Sets current directory on SSH server to parent directory. |
void |
setDownloadBlockSize(int blockSize)
Sets the transfer buffer size for download operation. |
void |
setFilePermissions(java.lang.String remoteFile,
int permissions)
Sets file permissions. |
void |
setLineTerminator(java.lang.String lineTerminator)
Sets destination line terminator used in ASCII file transfers. |
void |
setLocalDir(java.io.File localDirectory)
Sets local directory to be used in session. |
void |
setProxyAuthentication(java.lang.String proxyUsername,
java.lang.String proxyPassword)
Sets the proxy authentication username and password to use with proxy server. |
void |
setProxyHost(java.lang.String proxyHostname,
int proxyPort)
Sets the proxy hostname and port for this connection. |
void |
setProxyType(java.lang.String proxyType)
Sets the proxy type will be used for this FTP connection. |
void |
setReceiveBufferSize(int receiveBufferSize)
Sets the receive buffer size option of the sftp connection. |
void |
setSendBufferSize(int sendBufferSize)
Sets the send buffer size option of the sftp connection. |
void |
setTimeout(long timeout)
Sets the timeout for opening connection to SSH server. |
void |
setUploadBlockSize(int blockSize)
Sets the transfer buffer size for upload operations. |
void |
upload(byte[] data,
java.lang.String remoteFile)
Uploads file to SSH server where contents of file is not on disk but in memory. |
void |
upload(byte[] data,
java.lang.String remoteFile,
boolean append)
Uploads file to SSH server where contents of file is not on disk but in memory. |
void |
upload(java.io.File localFile)
Uploads file to SSH server. |
void |
upload(java.io.File localFile,
boolean append)
Uploads file to SSH server. |
void |
upload(java.io.File localFile,
java.lang.String remoteFile)
Uploads file to SSH server. |
void |
upload(java.io.File localFile,
java.lang.String remoteFile,
boolean append)
Uploads file to SSH server. |
void |
upload(java.io.InputStream input,
java.lang.String remoteFile)
Uploads file to SSH server. |
void |
upload(java.io.InputStream input,
java.lang.String remoteFile,
boolean append)
Uploads file to SSH server. |
void |
upload(java.lang.String localFile)
Uploads file to SSH server. |
void |
upload(java.lang.String localFile,
boolean append)
Uploads file to SSH server. |
void |
upload(java.lang.String extension,
java.io.File localFile)
Uploads a file to SSH server. |
void |
upload(java.lang.String localFile,
java.lang.String remoteFile)
Uploads file to SSH server. |
void |
upload(java.lang.String localFile,
java.lang.String remoteFile,
boolean append)
Uploads file to SSH server. |
void |
uploadDir(java.io.File localDirectory)
Uploads local directory and contents recursively to SSH server. |
void |
uploadDir(java.io.File localDir,
int retryLimit)
Uploads local directory and contents. |
void |
uploadDir(java.io.File localDirectory,
int retryLimit,
int threadCount)
Uploads local directory and contents recursively to SSH server. |
void |
uploadDir(java.io.File localDir,
int retryLimit,
int retryInterval,
java.lang.String extension)
Uploads local directory and contents. |
void |
uploadDir(java.io.File localDir,
int retryLimit,
int retryInterval,
java.lang.String extension,
int threadCount)
Uploads local directory and contents. |
void |
uploadDir(java.io.File localDir,
int retryLimit,
java.lang.String extension)
Uploads local directory and contents. |
void |
uploadDir(java.io.File localDir,
int retryLimit,
java.lang.String extension,
int threadCount)
Uploads local directory and contents. |
void |
uploadDir(java.io.File localDirectory,
java.lang.String remoteDirName,
java.lang.String extension)
Uploads local directory and contents recursively to SSH server. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int AUTO
public static final int ASCII
public static final int BINARY
public static final int ADAPTIVE_BLOCK_SIZE
Constructor Detail |
---|
public Sftp(SshParameters params)
params
- the connection parameterspublic Sftp(SshParameters params, SftpConfiguration config)
params
- the connection parametersconfig
- the connection configurationpublic Sftp(SshParameters params, java.io.File localDir)
params
- the connection parameterslocalDir
- the local working directorypublic Sftp(SshParameters params, java.io.File localDir, SftpConfiguration config)
params
- the connection parameterslocalDir
- the local working directoryconfig
- the connection configurationMethod Detail |
---|
public static void clearProxySettings()
public void addSftpListener(SftpListener listener)
listener
- the listener to addpublic void removeSftpListener(SftpListener listener)
listener
- the listener to removepublic long getTimeout()
public void setTimeout(long timeout)
timeout
- the timeout in millisecondspublic int getMode()
public void setAscii()
public void setBinary()
public void setAuto(boolean auto)
auto
- true
to turn automatic detect on
false
to turn offpublic void setBlockSize(int blockSize)
blockSize
- the size in bytespublic int getBlockSize()
public void setUploadBlockSize(int blockSize)
blockSize
- desired buffer sizepublic int getUploadBlockSize()
public void setDownloadBlockSize(int blockSize)
blockSize
- desired buffer sizepublic int getDownloadBlockSize()
public void setLineTerminator(java.lang.String lineTerminator)
null
. If null
, SFTP server must support ASCII transfers
and it will be the responsibility of server to perform conversion. Otherwise,
client will perform conversion from local system line terminator to specified
destination line terminator during transfer.
lineTerminator
- line terminatorpublic java.lang.String getLineTerminator()
null
. If null
, SFTP server must support ASCII transfers
and it will be the responsibility of server to perform conversion. Otherwise,
client will perform conversion from local system line terminator to specified
destination line terminator during transfer.
public void setProxyAuthentication(java.lang.String proxyUsername, java.lang.String proxyPassword)
proxyUsername
- the proxy usernameproxyPassword
- the proxy passwordclearProxySettings()
public void setProxyHost(java.lang.String proxyHostname, int proxyPort)
proxyHostname
- the hostname or ip address of the proxy serverproxyPort
- the port of the proxy server to connect toclearProxySettings()
public void setProxyType(java.lang.String proxyType)
proxyType
- The proxy type. Values allowed: HTTP, SOCKS5public void disableFileAccessLogging()
public void enableFileAccessLogging()
public void setDebug(boolean debug)
System.out
.
debug
- true
to turn debugging onsetDebugStream(java.io.PrintStream)
public void setDebugStream(java.io.PrintStream debugStream)
PrintStream
is System.out
.
debugStream
- the PrintStream
to send debug statements toPrintStream
public java.io.PrintStream getDebugStream()
PrintStream
used in reporting debugging statements.
Default PrintStream
is System.out
.
PrintStream
to send debug statements toPrintStream
public boolean isConnected()
true
if the service is connected;
false
otherwisepublic void connect() throws SftpException
SftpException
- if an I/O or SSH error occurs.SshParameters
public void disconnect()
public java.lang.String getDir()
public void setDir(java.lang.String remoteDirectory) throws SftpException
remoteDirectory
- the remote directory
SftpException
- if an I/O or SSH error occurs.public void setDirUp() throws SftpException
SftpException
- If an error occurspublic java.io.File getLocalDir()
public void setLocalDir(java.io.File localDirectory)
localDirectory
- the local directorypublic java.util.Enumeration getDirListing() throws SftpException
Enumeration
of SftpFile
objects
SftpException
- if an I/O or SSH error occurs.SftpFile
,
getDirListingAsString()
public java.util.Enumeration getDirListing(java.lang.String regex) throws SftpException
regex
- Regular expression used to obtain the file list
SftpException
- If an error occurs.public java.lang.String getDirListingAsString() throws SftpException
SftpException
- if an I/O or SSH error occurs.public java.lang.String getDirListingAsString(java.lang.String regex) throws SftpException
regex
- regular expression used to obtain the file list
SftpException
- if an I/O or SSH error occurs.public java.util.Enumeration getNameListing() throws SftpException
Enumeration
of String
where each item represents a file
or directory name
SftpException
- if an I/O or SSH error occurs.public java.util.Enumeration getNameListing(java.lang.String regex) throws SftpException
regex
- regular expression used to obtain the file list
Enumeration
of String
containing filenames
SftpException
- if an I/O or SSH error occurs.public java.util.Enumeration getLocalDirListing(java.lang.String regex)
regex
- Regular expression used to obtain the file list
Enumeration
of File
public java.util.Enumeration getLocalDirListing()
Enumeration
of File
public void makeDir(java.lang.String newDirectory) throws SftpException
newDirectory
- name of directory to make
SftpException
- if an I/O or SSH error occurs.public void makeDirRecursive(java.lang.String newDirectory) throws SftpException
newDirectory
- full path of directory to make
SftpException
- if an I/O or SSH error occurspublic java.io.File makeLocalDir(java.lang.String directoryName)
directoryName
- name of directory
getLocalDir()
public void deleteDir(java.lang.String remoteDirectory) throws SftpException
remoteDirectory
- the directory to delete
SftpException
- if an I/O or SSH error occurs.public void deleteDir(java.lang.String remoteDirectory, boolean recurse) throws SftpException
remoteDirectory
- the directory to delete.recurse
- true
if directory contents should be deleted recursively
SftpException
- if an I/O or SSH error occurs.public boolean isDirectory(java.lang.String remotePath) throws SftpException
remotePath
- remote pathname
true
if remote pathname denotes a directory; false
otherwise
SftpException
- if an I/O or SSH error occurs.public int getFilePermissions(java.lang.String remoteFile) throws SftpException
remoteFile
- the remote filename
SftpException
- if an I/O or SSH error occurs.public void setFilePermissions(java.lang.String remoteFile, int permissions) throws SftpException
remoteFile
- remote file namepermissions
- UNIX chmod file permissions
SftpException
- if an I/O or SSH error occurs.public void setSendBufferSize(int sendBufferSize)
sendBufferSize
- Send buffer size.public void setReceiveBufferSize(int receiveBufferSize)
receiveBufferSize
- Receive buffer size.public java.util.Date getFileTimestamp(java.lang.String remoteFile) throws SftpException
remoteFile
- the remote filename
SftpException
- if an I/O or SSH error occurs.public long getFilesize(java.lang.String remoteFile) throws SftpException
remoteFile
- the remote file
SftpException
- if an I/O or SSH error occurs.public java.io.InputStream getInputStream(java.lang.String filename, long offset) throws SftpException
InputStream
from SSH server for the purposes of downloading a file.
filename
- remote file name to downloadoffset
- file offset in bytes
InputStream
SftpException
- if an I/O or SSH error occurs.public java.io.OutputStream getOutputStream(java.lang.String filename, long offset, boolean append) throws SftpException
OutputStream
from SSH server for the purposes of uploading a file.
filename
- the remote filename to store file asoffset
- file offset in bytesappend
- true
to append to remote file on SSH server, false
otherwise
OutputStream
SftpException
- if an I/O or SSH error occurs.public void deleteFile(java.lang.String remoteFile) throws SftpException
remoteFile
- the file to delete
SftpException
- if an I/O or SSH error occurs.public void mdelete(java.lang.String regex) throws SftpException
regex
- the regular expression to use
SftpException
- if an I/O or SSH error occurs.public void renameFile(java.lang.String remoteFile, java.lang.String newFile) throws SftpException
remoteFile
- name of file to renamenewFile
- new name of file
SftpException
- if an I/O or SSH error occurs.public java.lang.String getRealPath(java.lang.String path) throws SftpException
path
- path to resolve
SftpException
- if an error occcurspublic boolean isValidPath(java.lang.String path) throws SftpException
path
- path to check
true
if path is valid;
false
otherwise
SftpException
- if an error occurspublic void interrupt()
true
.
After invoking this method you must reset the interrupted flag to false
before transferring any files.
reset()
public boolean interrupted()
true
if transfer process was interrupted;
false
otherwisepublic void reset()
false
.
This method should be invoked if you have interrupted a transfer
using the Sftp#interrupt
method and wish to resume transfering files.
interrupt()
public java.io.File download(java.lang.String remoteFile) throws SftpException
remoteFile
- the remote file to download
SftpException
- if an I/O or SSH error occurs.public java.io.File download(java.lang.String localFile, java.lang.String remoteFile) throws SftpException
localFile
- the local file to downloadremoteFile
- the remote file to download
SftpException
- if an I/O or SSH error occurs.public void download(java.io.OutputStream out, java.lang.String remoteFile) throws SftpException
OutputStream
.
out
- the OutputStream
to write file toremoteFile
- the remote file to download
SftpException
- if an I/O or SSH error occurs.public void download(java.io.OutputStream out, java.lang.String remoteFile, long off) throws SftpException
OutputStream
.
out
- the OutputStream
to write file toremoteFile
- the remote file to downloadoff
- the offset into the remote file in bytes
SftpException
- if an I/O or SSH error occurs.public java.io.File resumeDownload(java.lang.String remoteFile, long off) throws SftpException
remoteFile
- the file to downloadoff
- file offset in bytes
SftpException
- if an I/O or SSH error occurs.setLocalDir(File)
public java.io.File resumeDownload(java.lang.String localFile, java.lang.String remoteFile, long off) throws SftpException
localFile
- local file nameremoteFile
- the file to downloadoff
- file offset in bytes
SftpException
- if an I/O or SSH error occurs.setLocalDir(File)
public void downloadDir(java.lang.String remoteDirectory) throws SftpException
remoteDirectory
- the directory to download
SftpException
- if an I/O or SSH error occurs.setLocalDir(File)
public void downloadDir(java.lang.String remoteDir, int retryLimit) throws SftpException
remoteDir
- the directory to downloadretryLimit
- The retry limit number
SftpException
- if an I/O or SSH error occurs.setLocalDir(java.io.File)
public void downloadDir(java.lang.String remoteDir, int retryLimit, int retryInterval, int threadCount) throws SftpException
remoteDir
- the directory to downloadretryLimit
- The retry limit numberretryInterval
- the retry interval in secondsthreadCount
- the number of threads.
SftpException
- if an I/O or SSH error occurs.setLocalDir(java.io.File)
public void abortDownloadThreads()
public void downloadDir(java.lang.String remoteDir, int retryLimit, int retryInterval) throws SftpException
remoteDir
- the directory to downloadretryLimit
- The retry limit numberretryInterval
- the retry interval in seconds
SftpException
- if an I/O or SSH error occurs.setLocalDir(java.io.File)
public void mdownload(java.util.Enumeration fileNames) throws SftpException
downloadDir(String)
method.
Downloads are stored relative to current local directory.
fileNames
- filenames of files to download
SftpException
- if an I/O or SSH error occurs.downloadDir(String)
,
setLocalDir(File)
public void mdownload(java.lang.String regex) throws SftpException
downloadDir
method.
regex
- the filter to use
SftpException
- if an I/O or SSH error occurs.downloadDir(java.lang.String)
,
setLocalDir(File)
public void upload(byte[] data, java.lang.String remoteFile) throws SftpException
data
- the raw contents of the file to uploadremoteFile
- the filename to store file as on SSH server
SftpException
- if an I/O or SSH error occurs.public void upload(java.io.InputStream input, java.lang.String remoteFile, boolean append) throws SftpException
input
- the input stream to read fromremoteFile
- the filename to store file as on SSH serverappend
- true
to append to remote file, false
otherwise
SftpException
- if an I/O or SSH error occurspublic void upload(java.io.InputStream input, java.lang.String remoteFile) throws SftpException
input
- the input stream to read fromremoteFile
- the filename to store file as on SSH server
SftpException
- if an I/O or SSH error occurspublic void upload(byte[] data, java.lang.String remoteFile, boolean append) throws SftpException
data
- the raw contents of the file to uploadremoteFile
- the filename to store file as on SSH serverappend
- true
to appending to remote file
on SSH server; false
otherwise
SftpException
- if an I/O or SSH error occurs.public void upload(java.io.File localFile) throws SftpException
localFile
is a directory then directory and entire contents
are uploaded.
localFile
- the local file to upload
SftpException
- if an I/O or SSH error occurs.public void upload(java.lang.String extension, java.io.File localFile) throws SftpException
extension
- The extension will be usedlocalFile
- The local file to upload
SftpException
- if an I/O or SSH related error occurspublic void upload(java.io.File localFile, boolean append) throws SftpException
localFile
- the local file to uploadappend
- true
to appending to remote file
on SSH server, false
otherwise
SftpException
- if an I/O or SSH error occurs.public void upload(java.io.File localFile, java.lang.String remoteFile) throws SftpException
localFile
is a directory then directory and entire contents
are uploaded.
localFile
- the local file to uploadremoteFile
- the destination of upload
SftpException
- if an I/O or SSH error occurs.public void upload(java.io.File localFile, java.lang.String remoteFile, boolean append) throws SftpException
localFile
- the local file to uploadremoteFile
- the destination of uploadappend
- true
to appending to remote file
on SSH server, false
otherwise
SftpException
- if an I/O or SSH error occurs.public void upload(java.lang.String localFile) throws SftpException
localFile
- the local file to upload
SftpException
- if an I/O or SSH error occurs.setLocalDir(File)
public void upload(java.lang.String localFile, boolean append) throws SftpException
localFile
- the local file to uploadappend
- true
to appending to remote file
on SSH server, false
otherwise
SftpException
- if an I/O or SSH error occurs.public void upload(java.lang.String localFile, java.lang.String remoteFile) throws SftpException
localFile
- the local file to uploadremoteFile
- the destination filename of upload
SftpException
- if an I/O or SSH error occurs.setLocalDir(File)
public void upload(java.lang.String localFile, java.lang.String remoteFile, boolean append) throws SftpException
localFile
- the local file to uploadremoteFile
- the destination filename of uploadappend
- true
to appending to remote file
on SSH server, false
otherwise
SftpException
- if an I/O or SSH error occurs.setLocalDir(File)
public void resumeUpload(java.io.File localFile, long off) throws SftpException
localFile
- the local file to uploadoff
- file offset in bytes
SftpException
- if an I/O or SSH error occurs.public void resumeUpload(java.io.File localFile, java.lang.String remoteFile, long off) throws SftpException
localFile
- the local file to uploadremoteFile
- the destination remote fileoff
- the local file offset in bytes
SftpException
- if an I/O or SSH related error occurspublic void resumeUpload(java.lang.String localFile, long off) throws SftpException
localFile
- the local file to uploadoff
- file offset in bytes
SftpException
- if an I/O or SSH error occurs.setLocalDir(File)
public void resumeUpload(java.lang.String localFile, java.lang.String remoteFile, long off) throws SftpException
localFile
- the local file to uploadremoteFile
- the remote destination fileoff
- the local file offset in bytes
SftpException
- if an I/O or SSH error occurssetLocalDir(File)
public void uploadDir(java.io.File localDirectory) throws SftpException
localDirectory
- the directory to upload
SftpException
- if an I/O or SSH error occurs.public void uploadDir(java.io.File localDirectory, int retryLimit, int threadCount) throws SftpException
localDirectory
- the directory to uploadthreadCount
- the number of threads to spawn for uploadretryLimit
- number of times to retry if upload fails
SftpException
- if an I/O or SSH error occurs.public void uploadDir(java.io.File localDir, int retryLimit) throws SftpException
localDir
- the directory to uploadretryLimit
- number of times to retry if upload fails
SftpException
- if an I/O or SSH error occurs.public void uploadDir(java.io.File localDir, int retryLimit, java.lang.String extension) throws SftpException
localDir
- the directory to uploadretryLimit
- number of times to retry if upload failsextension
- the temporary extension which will be used to upload the files or null
for default extension
SftpException
- if an I/O or SSH error occurs.public void uploadDir(java.io.File localDir, int retryLimit, java.lang.String extension, int threadCount) throws SftpException
localDir
- the directory to uploadretryLimit
- number of times to retry if upload failsextension
- the temporary extension which will be used to upload the files or null
for default extensionthreadCount
- the number of new threads to spawn for upload.
SftpException
- if an I/O or SSH error occurs.public void uploadDir(java.io.File localDir, int retryLimit, int retryInterval, java.lang.String extension) throws SftpException
localDir
- the directory to uploadretryLimit
- number of times to retry if upload failsretryInterval
- retry interval in secondsextension
- the temporary extension which will be used to upload the files or null
for default extension
SftpException
- if an I/O or SSH error occurs.public void uploadDir(java.io.File localDir, int retryLimit, int retryInterval, java.lang.String extension, int threadCount) throws SftpException
localDir
- the directory to uploadretryLimit
- number of times to retry if upload failsretryInterval
- retry interval in secondsextension
- the temporary extension which will be used to upload the files or null
for default extensionthreadCount
- the upload thread count.
SftpException
- if an I/O or SSH error occurs.public void abortUploadThreads()
public void uploadDir(java.io.File localDirectory, java.lang.String remoteDirName, java.lang.String extension) throws SftpException
localDirectory
- the directory to uploadremoteDirName
- the remote directory nameextension
- The extension which will be used to upload the files
SftpException
- if an I/O or SSH error occurs.public void mupload(java.util.Enumeration fileNames) throws SftpException
fileNames
- filenames of files to upload
SftpException
- if an I/O or SSH error occurs.public void mupload(java.lang.String regex) throws SftpException
regex
- the regular expression to use
SftpException
- if an I/O or SSH error occurs.public SshHostKeys getHostKeys()
null
if keys are not availablepublic int getRecursiveDirectoryFileCount(java.lang.String directory)
directory
- - the remote directory name
public long getRecursiveDirectorySize(java.lang.String directory)
directory
- - the remote directory name
public java.util.Vector getRemoteFileList(java.lang.String remoteDir) throws SftpException
remoteDir
- Remote directory name
SftpException
- If a IO error occurs
|
Secure FTP Factory | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |