Skip to Content
0
Former Member
Nov 29, 2016 at 04:11 PM

exportResult

140 Views

Hi Folks, I have the following code to Export into CSV file and it is all working fine, I just Need the last part where I can get the Content of the Media model and put it into CSV file, thanks for help

       FileInputStream stream = null;

     try
     {
         stream = new FileInputStream("C:/export.impex");
         int content;
         while ((content = stream.read()) != -1)
         {
             // convert to char and display it
             System.out.println((char) content);
         }
     }
     catch (final FileNotFoundException e2)
     {
         // YTODO Auto-generated catch block

         e2.getMessage();
     } // read your impex
            final ExportConfig exportConfig = new ExportConfig();
         exportConfig.setScript(new StreamBasedImpExResource(stream, "UTF-8"));
         final ExportResult exportResult = exportService.exportData(exportConfig);

         if (exportResult.isError())
         {
             throw new ImpExException("Error exporting CSV file");
         }
         final ImpExMediaModel mediaModel = exportResult.getExportedData();
         
         final CSVWriter writer = new CSVWriter(new File("C:\\outlook.csv"), "utf-8");