public class FTPTestClient extends Object
| Constructor and Description |
|---|
FTPTestClient(String server,
int port,
String user,
String password) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
changeWorkingDirectory(String path) |
protected void |
connect()
Initiate a connection to the ftp server
|
boolean |
dirExists(String path)
Check if a directory exists by trying to go to it
|
void |
disconnect()
Disconnect the ftp client
|
boolean |
fileExists(String file)
Check if a file exists on the ftp server
|
org.apache.commons.net.ftp.FTPFile |
get(String path) |
String[] |
getFileList(String path)
Get a list of file names in a given directory for admin
|
String |
getWorkingDirectory() |
boolean |
isConnected()
Check if the ftp client is connected
|
boolean |
makeDir(String dir)
Create a directory
|
boolean |
putFile(String path,
byte[] content)
Upload a file to the ftp server
|
boolean |
putFile(String path,
String content)
Upload a file to the ftp server
|
void |
setTimestamp(String path,
LocalDateTime time) |
boolean |
testConnection() |
public boolean testConnection()
throws IOException
IOExceptionpublic String[] getFileList(String path) throws IOException
IOExceptionpublic String getWorkingDirectory() throws IOException
IOExceptionpublic boolean makeDir(String dir) throws IOException
dir - IOExceptionpublic org.apache.commons.net.ftp.FTPFile get(String path) throws IOException
IOExceptionpublic boolean putFile(String path, String content) throws IOException
path - the path to write incontent - the file's contentIOExceptionpublic boolean putFile(String path, byte[] content) throws IOException
path - the path to write incontent - the file's binary contentIOExceptionpublic boolean dirExists(String path) throws IOException
path - The directory to tryIOExceptionprotected void connect()
throws IOException
IOExceptionpublic boolean isConnected()
public void disconnect()
throws IOException
IOExceptionpublic boolean fileExists(String file) throws IOException
file - The name of the file to checkIOExceptionpublic boolean changeWorkingDirectory(String path) throws Exception
Exceptionpublic void setTimestamp(String path, LocalDateTime time) throws Exception
ExceptionCopyright © 2003–2018 MuleSoft, Inc.. All rights reserved.