I am getting a file in byte[]
which have comma separated values in quotes, I want to save it as CSV by using OpenCSV. I am using this to save it in CSV format.
Following is my code to convert byte[] to array and then store it in file
byte[] bytes = myByteStream.getFile();
String decoded = new String(bytes, "UTF-8");
//String lines[] = decoded.split("\\r?\\n");
FileOutputStream fos = new FileOutputStream("/home/myPC/Desktop/test.csv");
OutputStreamWriter osw = new OutputStreamWriter(fos, "UTF-8");
CSVWriter writer = new CSVWriter(osw);
String[] row = {decoded};
writer.writeNext(row);
writer.close();
osw.close();
But this above code puts extra quotes around and also merge all lines in one line.
Any help on how to do this properly ?