Package com.sabratec.util.ftp.as400
package com.sabratec.util.ftp.as400
-
Related PackagesPackageDescriptionThis package supplies an API for the ApplinX FTP mechanism.
It can be used instead of using the FTP dialog screens.
The main class in the package is GXFtpManager.
This is a singletone class and it can be accessed
only via theinstance()
method.
Another important class isGXFtpRequest
,
which is a data structure that contains all the relevant infomation for the FTP transmission.
Below are two code examples of uploading and downloading files:
Code sample for uploading a file to a Mainframe host:
GXFtpRequest uploadReq = new GXFtpRequest();
uploadReq.setUser(user);
uploadReq.setPassword(pass);
uploadReq.setServer(host ip address);
uploadReq.setRemoteFile(remote file using full path);
uploadReq.setValue(GXMFCommands.CMD_MF_DATA_TYPE, GXMFCommands.CMD_VAL_MF_DATA_TYPE_BIN)
try {
uploadReq.readFileToUpload(local file using full path);
GXFtpManager.instance().putFile(uploadReq);
} catch (GXGeneralException e) {
e.printStackTrace();
}
Code sample for downloading a file from a Mainframe host:
GXFtpRequest downloadReq = new GXFtpRequest();
downloadReq.setUser(user);
downloadReq.setPassword(pass);
downloadReq.setServer(host ip address);
downloadReq.setRemoteFile(remote file using full path);
downloadReq.setValue(GXMFCommands.CMD_MF_DATA_TYPE, GXMFCommands.CMD_VAL_MF_DATA_TYPE_BIN);
try {
GXFtpResponse resp = GXFtpManager.instance().getFile(downloadReq);
resp.writeFileToDisk(local file using full path);
} catch (GXFtpException e) {
e.getMessage();
}
-
ClassesClassDescriptionThis class holds constants for the AS400 FTP commands and their possible values: AS400 designated commands