I try and write my array to a file, however instead of my data, all I get is two cells; One is [Ljava.lang.String;@7b1ddcde and the other is [Lorg.supercsv.cellprocessor.ift.CellProcessor;@658fb1f7 I have no idea how on earth this is happening, as my array is actually a very nice set of data and works when I print it to the console.
My table has all of the headers and required cells, it's just that these weird errors take up the first two cells and no other data is written.
My CellProcessor method is just full of new Optional(), so I don't think that's the issue here.
Here is the entire method. I am so sorry, my code is horrible it was made in a hurry.
static String[] writeWithCsvListWriter(String filename) throws Exception {
ICsvListWriter listWriter = null;
try {
listWriter = new CsvListWriter(new FileWriter(Main.filename + ".csv"),
CsvPreference.STANDARD_PREFERENCE);
final CellProcessor[] processors = getProcessors();
final String[] header = new String[] { "Year", "mm", "Max Temp", "Min Temp",
"af days", "Rain", "Sun" };
listWriter.writeHeader(header);
FileReader fileReader = new FileReader(filename);
BufferedReader bufferedReader = new BufferedReader(fileReader);
List<String> lines = new ArrayList<String>();
String line = null;
int i = 0;
while ((line = bufferedReader.readLine()) != null) {
if(line.startsWith(" 2010")){
try {
String[] splitArray = line.split("\\s+");
System.out.println("Writing Array");
listWriter.write(splitArray, processors);
} catch (PatternSyntaxException ex) {
}
}
i++;
}
bufferedReader.close();
} finally {
if( listWriter != null ) {
listWriter.close();
}
}
return null;
}
toStringof your arrays.