How to correct output from the CsvListWriter.write method in my java code using SuperCSV -
i have 2 questions in writewithcsvlistwriter method below.
here code:
private static void writewithcsvlistwriter() throws exception { // create customer lists (csvlistwriter accepts arrays!) final list<object> newcsvfile = readwithcsvlistreader(); icsvlistwriter listwriter = null; try { listwriter = new csvlistwriter(new filewriter("/temp/customfieldlogentriestest_new.csv"), csvpreference.standard_preference); final cellprocessor[] processors = getprocessors(); final string[] header = new string[] { "id", "school_id", "source_class", "source_id", "field_id", "form_record_id", "imported", "log_field1", "log_field2", "log_field3", "log_field4", "log_field5", "log_field6", "log_field7", "log_field8", "log_field9", "log_field10", "log_field11", "log_field12", "log_field13", "log_field14", "log_field15", "log_field16", "log_field17", "log_field18", "log_field19", "log_field20", "log_field21", "log_field22", "log_field23", "log_field24", "log_field25", "log_field26", "log_field27", "log_field28", "log_field29", "log_field30", "legacy_id", "legacy_field_id"}; // write header listwriter.writeheader(header); // write new csv file listwriter.write(newcsvfile, processors); } { if( listwriter != null ) { listwriter.close(); } } }
i writing out first line out of 1,056,039 lines csv file i'm creating , contains column names looks fine , first record list looks this:
"[1, 48, sisstudent, 202923, 13, null, null, 8921, 01-dec-03, 8918, 2004-12-01 00:00:00, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 133336003, 400009180]",[lorg.supercsv.cellprocessor.ift.cellprocessor;@279f2327
my first question how remove opening double quote , opening brace , closing brace , closing double quote along following comma , [lorg.supercsv.cellprocessor.ift.cellprocessor;@279f2327 record , subsequent records? had tried passing in newcsvfile.tostring() write method stated in other posts didn't help.
- second question when tried load records file getting java.lang.outofmemoryerror: java heap space error:
exception in thread "main" java.lang.outofmemoryerror: java heap space
i had modified eclipse.ini file remedy including these 2 lines did nothing error: -xms512m -xmx2048m
any help/direction appreciated. thank you.
Comments
Post a Comment