Package org.hl7.fhir.utilities
Class FTPClient
- java.lang.Object
-
- org.hl7.fhir.utilities.FTPClient
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconnect()Connect to the server, throw an exception if it failsprotected voidcreateRemotePathIfNotExists(String filePath)Takes a file path and creates all intermediate directories if they do not yet exist.voiddelete(String path)Delete a file on the FTP servervoiddisconnect()static voidmain(String[] args)protected booleanremotePathExists(String path)voidupload(String source, String path)Upload a file from the local system to the FTP Server
-
-
-
Constructor Detail
-
FTPClient
public FTPClient(String server, String path, String user, String password)
Connect to an FTP server- Parameters:
server- - the server to connect to (usually just an IP address). It's up to the system to figure out access (VPN etc)path- - the path on the FTP server to treat all the operations as relative touser- - username for the FTP serverpassword- - password for the FTP server
-
-
Method Detail
-
connect
public void connect() throws IOException
Connect to the server, throw an exception if it fails- Throws:
IOException
-
delete
public void delete(String path) throws IOException
Delete a file on the FTP server- Parameters:
path- - relative to the path provided in the constructor- Throws:
IOException
-
createRemotePathIfNotExists
protected void createRemotePathIfNotExists(String filePath) throws IOException
Takes a file path and creates all intermediate directories if they do not yet exist.- Parameters:
filePath- relative to the path provided in the constructor and including the file name- Throws:
IOException
-
remotePathExists
protected boolean remotePathExists(String path) throws IOException
- Throws:
IOException
-
upload
public void upload(String source, String path) throws IOException
Upload a file from the local system to the FTP Server- Parameters:
source- - absolute path on local systempath- - relative to the path provided in the constructor- Throws:
IOException
-
disconnect
public void disconnect() throws IOException
- Throws:
IOException
-
main
public static void main(String[] args) throws IOException, FHIRException
- Throws:
IOExceptionFHIRException
-
-