}
@Override
void bytesToFile(byte[] bytes, File file) throws GatewayException
{
RemoteFileSystem rfs = null;
try
{
EPR epr = ListenerUtil.assembleEpr(config);
if (!(epr instanceof FTPEpr))
throw new Exception("This Gateway only accepts FTP and SFTP.");
FTPEpr ftpEpr = (FTPEpr) epr;
rfs = RemoteFileSystemFactory.getRemoteFileSystem(ftpEpr, true);
rfs.setRemoteDir(FtpClientUtil.fileToFtpString(_inputDirectory));
File tmpFile = File.createTempFile("RemoteGW", ".forUpload");
super.bytesToFile(bytes, tmpFile);
rfs.uploadFile(tmpFile, file.getName());
tmpFile.delete();
} catch (Exception e) {
throw new GatewayException(e);
} finally {
if (null != rfs)
rfs.quit();
}
}