|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.xbus.technical.ftp.FTPConnection
public class FTPConnection
FTPConnection
manages connections to FTP servers and provide
methods for read and write access of files via FTP.
Method Summary | |
---|---|
void |
close()
Closes the connection to the FTP server |
void |
delete(java.lang.String workDir,
java.lang.String fileName)
Deletes a file on the FTP server. |
boolean |
existsFile(java.lang.String workDir,
java.lang.String fileName)
Checks if a file exists on the FTP server. |
static java.lang.String |
getFileName(java.lang.String name)
Extracts the name of the file itself from a complete file name. |
java.lang.String |
getFTPName(java.lang.String workDir,
java.lang.String fileName)
Returns a string containing host, port, working directory and name of the file, mainly used for tracing. |
static FTPConnection |
getInstance(java.lang.String name)
Delivers an open instance of FTPConnection . |
static java.lang.String |
getWorkingDirectory(java.lang.String name)
Extracts the name of the directory from a complete file name. |
void |
rename(java.lang.String workDir,
java.lang.String fromFile,
java.lang.String toFile)
Renames a file on the FTP server. |
java.lang.String |
retrieveFile(java.lang.String workDir,
java.lang.String fileName,
java.lang.String encoding)
Retrieves the content of a file from the FTP server. |
void |
storeFile(java.lang.String data,
java.lang.String workDir,
java.lang.String fileName,
java.lang.String encoding)
Writes the given data to a file on the FTP server. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static FTPConnection getInstance(java.lang.String name) throws XException
FTPConnection
.
If it is the first call with this name for the actual thread, a new
FTPConnection
object will be created. Subsequent calls in
this thread will deliver the object, that has been created by the first
call.
name
- name of the FTPConnection
XException
- if something goes wrongpublic void close()
public java.lang.String retrieveFile(java.lang.String workDir, java.lang.String fileName, java.lang.String encoding) throws XException
workDir
- working directory where the file is stored, may be nullfileName
- name of the file without any directory informationencoding
- encoding of the file
XException
- if something goes wrong, e.g. the file doesn't existpublic void storeFile(java.lang.String data, java.lang.String workDir, java.lang.String fileName, java.lang.String encoding) throws XException
data
- new content of the file on the serverworkDir
- working directory where the file shall be stored, may be nullfileName
- name of the file without any directory informationencoding
- encoding of the file
XException
- if something goes wrong, e.g. the working directory doesn't
existpublic void rename(java.lang.String workDir, java.lang.String fromFile, java.lang.String toFile) throws XException
workDir
- working directory, may be nullfromFile
- old name of the file, without any directory informationtoFile
- new name of the file, without any directory information
XException
- if something goes wrong, e.g. the fromFile
doesn't existpublic void delete(java.lang.String workDir, java.lang.String fileName) throws XException
workDir
- working directory, may be nullfileName
- name of the file that shall be deleted, without any directory
information
XException
- if something goes wrong, e.g. the file doesn't existpublic boolean existsFile(java.lang.String workDir, java.lang.String fileName) throws XException
workDir
- working directory, may be nullfileName
- name of the file, without any directory information
true
if the file exists, false
if
not
XException
- if something goes wrongpublic java.lang.String getFTPName(java.lang.String workDir, java.lang.String fileName)
workDir
- working directory, may be nullfileName
- name of the file, without any directory information
public static java.lang.String getWorkingDirectory(java.lang.String name)
name
- complete name of a file, containing directory and file name
null
if
the name doesn't contain any directory informationpublic static java.lang.String getFileName(java.lang.String name) throws XException
name
- complete name of a file, containing directory and file name
XException
- if the name of the file can't be extracted, e.g. the given
name ends with a slash
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |