如何用Java编写代码以读取JPA中的过程并将其写入FTP路径中的CSV文件

 List<Object[]> result=null;
        try {
            em = getEntityManager();
            if(null!=em){
                Query query =   em.createNativeQuery("{call procedure Name('"+geoLocationName+"')}"); 
                result =query.getResultList(); 
            }else{
                logger.info("Connection is not successfull");
            }
        }catch (Exception ex) {
            logger.error("Error while fetching data from ::"+ex.getMessage());
        } finally {
            if(null!=em){

                em.close();

            }

        }

我正在使用上面的代码阅读过程

现在,我如何将结果写入到csv文件中,而该文件必须存储在ftp路径中而不存储在本地。