public abstract class FtpImplementation
extends java.lang.Object
Constructor and Description |
---|
FtpImplementation() |
Modifier and Type | Method and Description |
---|---|
void |
addListener(FtpListener listener)
Removes specified Ftp event listener.
|
abstract void |
changePassword(java.lang.String oldPassword,
java.lang.String newPassword)
Changes the password.
|
void |
clearProxySettings()
Clears SOCKS related settings.
|
abstract void |
connect()
Connects to FTP server and performs login.
|
abstract void |
connect(boolean login)
Connects to FTP server and optionally performs login
|
abstract void |
deleteDir(java.lang.String remoteName,
boolean recurse)
Deletes directory from FTP server.
|
abstract void |
deleteFile(java.lang.String remoteName)
Deletes remote file from FTP server.
|
abstract void |
dirUp()
Sets current directory on FTP server to parent directory.
|
abstract void |
disconnect()
Quits FTP session and disconnects from FTP server.
|
abstract void |
download(java.io.OutputStream out,
java.lang.String remoteName,
long off)
Downloads file from FTP server and writes contents to provided OutputStream.
|
java.lang.String |
getAccount()
Gets account for FTP server.
|
boolean |
getAutoDetectIpv6()
Get auto detect Ipv6 mode.
|
int |
getBlockTransferSize()
Gets blocksize for use in transferring files.
|
abstract boolean |
getCompression()
Gets whether the data is compressed during the transfering.
|
abstract boolean |
getConnectBeforeCommand()
Gets the connectBefore indicator
|
abstract int |
getDataPort() |
abstract int |
getDataPortEnd()
Gets the data port end range for incoming data connections
|
abstract int |
getDataPortStart()
Gets the data port start range for incoming data connections
|
boolean |
getDebug()
Gets debugging state.
|
java.io.PrintStream |
getDebugStream()
Gets PrintStream used in reporting debugPrint statements.
|
abstract java.lang.String |
getDir()
Gets current working directory of FTP server.
|
abstract java.util.Vector |
getDirListing(java.lang.String filter)
Gets directory listing from FTP server.
|
java.lang.String |
getDirListingAsString(java.lang.String filter)
Gets file listing of files matching filter criteria.
|
java.lang.String |
getDiskEncoding()
Gets character encoding used when reading data from disk for ASCII file transfer.
|
java.lang.String |
getEncoding()
Deprecated.
use the getWireEncoding method
|
abstract boolean |
getErrorOnSizeCommand()
Gets the error on size command indicator.
|
abstract java.util.Vector |
getFeatures()
Returns supported server features.
|
abstract long |
getFileSize(java.lang.String remoteName)
Gets filesize of remote file from FTP server as represented in ASCII.
|
abstract java.util.Date |
getFileTimeStamp(java.lang.String remoteName)
Gets date/timestamp of remote file from FTP server
This feature is not supported by RFC-959 so may not work on all FTP servers.
|
java.lang.String |
getHost()
Gets hostname of FTP server.
|
abstract java.io.InputStream |
getInputStream(java.lang.String remoteName,
long off)
Gets the InputStream from the data connection
|
boolean |
getKeepAlive()
Get keep alive.
|
int |
getLinger()
Get Linger.
|
java.util.Vector |
getListeners()
Get listeners.
|
abstract java.util.Vector |
getMachineDirListing(java.lang.String dirname)
Gets file listing of specified directory using MLSD command.
|
abstract java.util.Vector |
getMachineDirListing(java.lang.String dirname,
java.lang.String regex)
Gets file listing of specified directory using MLSD command.
|
abstract FtpFile |
getMachineFileListing(java.lang.String filename)
Gets the file description for the specified filename.
|
abstract java.util.Vector |
getNameListing(java.lang.String filter) |
abstract java.lang.String |
getNATAddress()
Get the NAT Address
|
abstract java.io.OutputStream |
getOutputStream(java.lang.String fileName,
boolean append,
long off)
Gets the OutputStream from the data connection
|
java.lang.String |
getPassword()
Returns current FTP user password.
|
int |
getPort()
Gets port of FTP server.
|
java.lang.String |
getPortAddress()
Gets the external address to use when using active connections using the PORT command.
|
boolean |
getPreserveDownloadTimestamp()
Get preserve download timestamp.
|
boolean |
getPreserveUploadTimestamp()
Get upload modification time.
|
java.lang.String |
getProxyHostname()
Get proxy hostname.
|
java.lang.String |
getProxyPassword()
Get proxy password.
|
int |
getProxyPort()
Get proxy port.
|
java.lang.String |
getProxyType()
Get proxy type.
|
java.lang.String |
getProxyUsername()
Get proxy username.
|
abstract int |
getResponseCode()
Gets response code from last FTP command.
|
abstract java.lang.String |
getSystemType()
Gets the system type of remote FTP server.
|
boolean |
getTcpNoDelay() |
int |
getTimeout()
Gets the timeout for opening connection to FTP server.
|
java.util.TimeZone |
getTimeZone()
Get the associated timezone.
|
abstract int |
getTransferMode()
Returns current transfer mode.
|
abstract boolean |
getUseEPRT()
Gets use EPRT value.
|
abstract boolean |
getUseEPSV()
Gets use EPSV value.
|
java.lang.String |
getUser()
Gets username of FTP user.
|
java.lang.String |
getWireEncoding()
Gets character encoding used when issuing commands and reading files from FTP server in ASCII mode.
|
void |
interrupt()
Interrupts the current data transfer and sets interrupted flag to true.
|
boolean |
interrupted()
Checks if transfer process was interrupted.
|
abstract boolean |
isConnected()
Checks if client is connected to FTP server.
|
abstract boolean |
isFeatureSupported(java.lang.String command)
Looks for the command argument into the server features list to validate if it is supported
|
abstract boolean |
isPassive()
Tests the passive mode for data connections.
|
abstract java.lang.String |
issueCommand(java.lang.String command)
Issues command to FTP server.
|
abstract java.lang.String |
issueCommandCheck(java.lang.String command)
Issues command to FTP server.
|
abstract void |
login()
Logs into FTP server after establishing a connection.
|
abstract void |
makeDir(java.lang.String newName)
Makes directory on FTP server.
|
abstract java.lang.String |
noop()
Sends a NOOP (No Operation) command to FTP server.
|
abstract void |
readResponse()
Reads server response
|
void |
removeListener(FtpListener listener) |
abstract void |
renameFile(java.lang.String remoteName,
java.lang.String newName)
Renames remote file on FTP server.
|
void |
reset()
Resets the interrupted flag to false.
|
void |
setAccount(java.lang.String account)
Sets optional account for FTP server.
|
void |
setAuto(boolean autoMode)
Sets transfer mode automatically based on file extension.
|
void |
setAutoDetectIpv6(boolean autoDetect)
Set auto detect Ipv6 mode.
|
void |
setBlockTransferSize(int size)
Sets block size for use in transferring files.
|
abstract void |
setCompression(boolean compression)
Sets whether the data will be compressed during the transfer.
|
abstract void |
setConnectBeforeCommand(boolean connect)
Sets the connectBefore property value
|
abstract void |
setDataPort(int dataPort) |
abstract void |
setDataPortEnd(int dataPort)
Sets the end data port range for incomings connections
|
abstract void |
setDataPortStart(int dataPort)
Sets the start data port range for incomings connections
|
void |
setDebug(boolean debug)
Sets debugging state.
|
void |
setDebugStream(java.io.PrintStream debugStream)
Sets PrintStream used in reporting debugPrint statements.
|
abstract void |
setDir(java.lang.String remoteName)
Sets current directory on FTP server.
|
void |
setDiskEncoding(java.lang.String encoding)
Sets character set used when reading data from disk for ASCII file transfer.
|
void |
setEncoding(java.lang.String encoding)
Deprecated.
use the setWireEncoding method
|
abstract void |
setErrorOnSizeCommand(boolean error)
Sets the indicator value which will be used by methods that invokes
getFileSize.
|
abstract void |
setFileCreationTime(java.lang.String remoteName,
java.util.Date date)
Sets file creation time with a new value.
|
abstract void |
setFileModificationTime(java.lang.String remoteName,
java.util.Date date)
Sets the file modification time with a new value.
|
void |
setFtp(Ftp ftp)
Sets reference to FTP instance.
|
void |
setHost(java.lang.String host)
Sets hostname of FTP server.
|
void |
setKeepAlive(boolean keepAlive)
Set socket keep alive.
|
void |
setLinger(int linger)
Set Linger.
|
void |
setListeners(java.util.Vector listeners)
Set listeners.
|
abstract void |
setNATAddress(java.lang.String ipAddress)
Sets a NAT address which will be used after PASV command.
|
abstract void |
setPassive(boolean passive)
Sets the passive mode for data connections.
|
void |
setPassword(java.lang.String pwd)
Sets password of FTP user.
|
void |
setPort(int port)
Sets port of FTP server.
|
void |
setPortAddress(java.lang.String string)
Sets the external address to use when using active connections using the PORT command.
|
void |
setPreserveDownloadTimestamp(boolean value)
Set the preserve download timestamp value.
|
void |
setPreserveUploadTimestamp(boolean value)
Set upload modification time, replaces the last modified timestamp with that of the local file after upload is complete.
|
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 FTP connection.
|
void |
setProxyType(java.lang.String proxyType)
Sets the proxy type will be used for this FTP connection.
|
abstract void |
setReceiveBufferSize(int receiveBufferSize)
Sets the receive buffer size option of the ftp connection.
|
abstract void |
setSendBufferSize(int sendBufferSize)
Sets the send buffer size option of the ftp connection.
|
void |
setTargetFile(java.lang.String file)
Sets target file name.
|
void |
setTargetPath(java.lang.String path)
Sets target path.
|
void |
setTcpNoDelay(boolean value) |
void |
setTimeout(int timeout)
Sets the timeout for opening connection to FTP server.
|
void |
setTimezone(java.util.TimeZone timeZone)
Set the timezone.
|
abstract void |
setTransferMode(int mode)
Sets transfer mode.
|
abstract void |
setUseEPRT(boolean value)
Sets use EPSV indicator.
|
abstract void |
setUseEPSV(boolean useEPSV)
Sets use EPSV indicator.
|
void |
setUser(java.lang.String user)
Sets username of FTP user.
|
void |
setWireEncoding(java.lang.String encoding)
Sets character set used when issuing commands and transferring files in ASCII mode.
|
abstract java.lang.String |
upload(java.io.InputStream in,
java.lang.String remoteName,
boolean append,
long off,
long total,
boolean unique)
Uploads data to FTP server.
|
abstract java.lang.String |
uploadUnique(java.io.InputStream in,
java.lang.String fileName)
Uploads the data as file to be created in the current directory
under a name unique to that directory
|
public void setFtp(Ftp ftp)
ftp
- reference to FTP instance.public void setTimezone(java.util.TimeZone timeZone)
timeZone
- public java.util.TimeZone getTimeZone()
public void setPreserveDownloadTimestamp(boolean value)
value
- public boolean getPreserveDownloadTimestamp()
public boolean getPreserveUploadTimestamp()
public void setPreserveUploadTimestamp(boolean value)
value
- - boolean valuepublic void setAutoDetectIpv6(boolean autoDetect)
autoDetect
- public boolean getAutoDetectIpv6()
public java.lang.String getHost()
public java.lang.String getAccount()
setUser(String)
public void setAuto(boolean autoMode)
autoMode
- public void setHost(java.lang.String host)
host
- the hostname or IP address of FTP serverpublic void setAccount(java.lang.String account)
account
- setUser(String)
public int getPort()
public void setPort(int port)
port
- the port of FTP serverpublic java.lang.String getUser()
public void setUser(java.lang.String user)
user
- the username of FTP userpublic abstract void setUseEPSV(boolean useEPSV)
useEPSV
- The use EPSV valuepublic abstract boolean getUseEPSV()
true
the passive mode will be sent EPSV commandpublic abstract void setUseEPRT(boolean value)
value
- The use EPSV valuepublic abstract boolean getUseEPRT()
true
the passive mode will be sent EPRT commandpublic java.lang.String getPassword()
public void setPassword(java.lang.String pwd)
pwd
- the password of FTP userpublic int getTimeout()
public void setTimeout(int timeout)
timeout
- the timeout in millisecondspublic void setLinger(int linger)
linger
- public int getLinger()
public void setKeepAlive(boolean keepAlive)
keepAlive
- public boolean getKeepAlive()
public boolean getTcpNoDelay()
public void setTcpNoDelay(boolean value)
public java.lang.String getEncoding()
public void setEncoding(java.lang.String encoding)
encoding
- the character encoding to be usedpublic abstract void setErrorOnSizeCommand(boolean error)
error
- Error indicator valuepublic abstract boolean getErrorOnSizeCommand()
true
then method which invokes getFileSize will throw
an exception when it caused an error, false
the error will be ignored.public boolean interrupted()
public void interrupt()
public void reset()
public abstract void connect() throws FtpException
FtpException
- if an I/O or FTP error occurs.public abstract void setDataPort(int dataPort)
public abstract int getDataPort()
public abstract void setConnectBeforeCommand(boolean connect)
connect
- It indicates if the connection will be established before
send the commandpublic abstract boolean getConnectBeforeCommand()
true
the connection will be establiched before send the commandpublic abstract int getDataPortStart()
public abstract int getDataPortEnd()
public abstract void setDataPortStart(int dataPort)
dataPort
- Start data Port range for incomings connectionspublic abstract void setDataPortEnd(int dataPort)
dataPort
- End data Port range for incomings connectionspublic abstract void connect(boolean login) throws FtpException
login
- true to login false otherwiseFtpException
- if an I/O or FTP error occurspublic abstract void login() throws FtpException
FtpException
- if an I/O or FTP error occurspublic abstract void changePassword(java.lang.String oldPassword, java.lang.String newPassword) throws FtpException
oldPassword
- The old password.newPassword
- The new password.FtpException
- FtpException if underlayed I/O or FTP error occurs.public abstract void disconnect()
public abstract boolean isConnected()
true
if connected false
otherwisepublic abstract java.lang.String issueCommand(java.lang.String command) throws FtpException
command
- the command to issueFtpException
- if an I/O or FTP error occurspublic abstract java.lang.String issueCommandCheck(java.lang.String command) throws FtpException
command
- the command to issueFtpException
- if an I/O or FTP error occurspublic abstract boolean isFeatureSupported(java.lang.String command)
command
- The feature will be searchedtrue
if the command is found into the server feature list;
false
otherwisepublic abstract java.lang.String upload(java.io.InputStream in, java.lang.String remoteName, boolean append, long off, long total, boolean unique) throws FtpException
in
- data input stream.remoteName
- the filename to store file as on FTP serverappend
- true
to append to remote file on FTP server,
false
otherwiseoff
- file offset.total
- total data lenghtunique
- To use upload unique fileFtpException
- if an I/O or FTP error occurs.public abstract void download(java.io.OutputStream out, java.lang.String remoteName, long off) throws FtpException
out
- data output stream.remoteName
- the filename to store file as on FTP server.off
- file offsetFtpException
- if an I/O or FTP error occurs.public abstract java.io.InputStream getInputStream(java.lang.String remoteName, long off) throws FtpException
remoteName
- Remote file nameoff
- file offsetFtpException
- if FTP error occurs.public abstract java.io.OutputStream getOutputStream(java.lang.String fileName, boolean append, long off) throws FtpException
fileName
- The name of the fileappend
- true
to append to remote file on FTP server,
false
otherwiseoff
- file offsetFtpException
- if FTP error occurs.public abstract java.lang.String uploadUnique(java.io.InputStream in, java.lang.String fileName) throws FtpException
in
- data input stream.fileName
- The file NameFtpException
public abstract long getFileSize(java.lang.String remoteName) throws FtpException
remoteName
- the remote fileFtpException
- if an I/O or FTP error occurs.public abstract java.util.Date getFileTimeStamp(java.lang.String remoteName) throws FtpException
remoteName
- the remote fileFtpException
- if an I/O or FTP error occurs.public abstract void setFileCreationTime(java.lang.String remoteName, java.util.Date date) throws FtpException
remoteName
- File will be modified its creation time.date
- The new creation timeFtpException
- If an error occurs.public abstract void setFileModificationTime(java.lang.String remoteName, java.util.Date date) throws FtpException
remoteName
- File will be modified its modification time.date
- The new modification timeFtpException
- If an error occurspublic abstract void deleteFile(java.lang.String remoteName) throws FtpException
remoteName
- name of file to deleteFtpException
- if an I/O or FTP error occurs.public abstract void renameFile(java.lang.String remoteName, java.lang.String newName) throws FtpException
remoteName
- name of file to renamenewName
- new name of fileFtpException
- if an I/O or FTP error occurs.public abstract java.util.Vector getDirListing(java.lang.String filter) throws FtpException
filter
- the filename filterVector
of String
objectsFtpException
- if an I/O or FTP error occurs.public abstract java.util.Vector getNameListing(java.lang.String filter) throws FtpException
FtpException
public abstract java.lang.String getDir() throws FtpException
FtpException
- if an I/O or FTP error occurs.public abstract void setDir(java.lang.String remoteName) throws FtpException
remoteName
- the remote directoryFtpException
- if an I/O or FTP error occurs.public abstract void dirUp() throws FtpException
FtpException
- if an I/O or FTP error occurs.public abstract void makeDir(java.lang.String newName) throws FtpException
newName
- name of directory to makeFtpException
- if an I/O or FTP error occurs.public abstract void deleteDir(java.lang.String remoteName, boolean recurse) throws FtpException
remoteName
- the directory to removerecurse
- true
if it should delete files and
subdirectories within directoryFtpException
- if an I/O or FTP error occurs.public java.lang.String getDirListingAsString(java.lang.String filter) throws FtpException
filter
- a filename filterFtpException
- if an I/O or FTP error occurs.public abstract FtpFile getMachineFileListing(java.lang.String filename) throws FtpException
filename
- target filename. May be empty for current diectoryFtpException
- if an error occurspublic abstract java.util.Vector getMachineDirListing(java.lang.String dirname) throws FtpException
dirname
- directory nameFtpException
- if an error occurspublic abstract java.util.Vector getMachineDirListing(java.lang.String dirname, java.lang.String regex) throws FtpException
dirname
- regex
- FtpException
public abstract java.util.Vector getFeatures() throws FtpException
FtpException
- if an error occurspublic abstract java.lang.String getSystemType() throws FtpException
FtpException
- if an I/O or FTP error occurs.public abstract java.lang.String noop() throws FtpException
FtpException
- if an I/O or FTP error occurspublic abstract int getTransferMode()
public abstract void setTransferMode(int mode) throws FtpException
mode
- desired transfer mode.FtpException
- if underlayed I/O or FTP error occurs.public abstract boolean isPassive()
public abstract void setPassive(boolean passive)
passive
- if true, the transfers will be passive.public abstract void setNATAddress(java.lang.String ipAddress) throws FtpException
ipAddress
- The NAT IP address.FtpException
- If an error occurs.public abstract java.lang.String getNATAddress()
public abstract void setCompression(boolean compression)
compression
- Compression indicator.public abstract boolean getCompression()
true
data will be compressed, false
otherwise.public abstract int getResponseCode()
public int getBlockTransferSize()
public void setBlockTransferSize(int size)
size
- the blocksize in bytespublic boolean getDebug()
true
if debugging is onpublic void setDebug(boolean debug)
debug
- true
to turn debugging onpublic java.io.PrintStream getDebugStream()
public void setDebugStream(java.io.PrintStream debugStream)
debugStream
- the PrintStream to send debugPrint statements topublic void addListener(FtpListener listener)
listener
- the listener to removepublic void removeListener(FtpListener listener)
listener
- public java.util.Vector getListeners()
public void setListeners(java.util.Vector listeners)
listeners
- public void setTargetFile(java.lang.String file)
file
- target file name.public void setTargetPath(java.lang.String path)
path
- target path.public java.lang.String getDiskEncoding()
public void setDiskEncoding(java.lang.String encoding)
encoding
- the character encoding to be usedpublic java.lang.String getWireEncoding()
public void setWireEncoding(java.lang.String encoding)
encoding
- the character encoding to be usedpublic java.lang.String getPortAddress()
public void setPortAddress(java.lang.String string)
string
- an ip addresspublic void setProxyAuthentication(java.lang.String proxyUsername, java.lang.String proxyPassword)
proxyUsername
- the proxy usernameproxyPassword
- the proxy passwordclearProxySettings()
public java.lang.String getProxyUsername()
public java.lang.String getProxyPassword()
public java.lang.String getProxyHostname()
public int getProxyPort()
public java.lang.String getProxyType()
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 clearProxySettings()
public abstract void readResponse() throws FtpException
FtpException
- if underlayed I/O or FTP error occurs.public abstract void setSendBufferSize(int sendBufferSize)
sendBufferSize
- Send buffer size.public abstract void setReceiveBufferSize(int receiveBufferSize)
receiveBufferSize
- Receive buffer size.Copyright © JSCAPE LLC. 1999-2021. All Rights Reserved