I'm parsing Outlook SCV
file to ArrayList
.
Then i want to get String
values of the Array
list i'm getting.
Here is the code:
if(arr != null){
try{
for (int i = 1; i < arr.size(); i++) {
oneRow = new ArrayList();
oneRow.add(arr.get(i));
for (int j = 0; j < oneRow.size(); j++) {
StringBuilder strBuild = new StringBuilder();
strBuild.append(String.valueOf(oneRow.get(j).toString()));
No matter what i tried, i can't get the String
Value.
What i get is : [Ljava.lang.string @....
Here is the Class that makes the ArrayList
which getting the CSV
file and building the ArrayList
:
public class ReadingCSV {
InputStream inputStream;
public ReadingCSV(InputStream inputStream){
this.inputStream = inputStream;
}
public List read(){
ArrayList resultList = new ArrayList();
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
try {
String csvLine;
while ((csvLine = reader.readLine()) != null) {
String[] row = csvLine.split(",");
resultList.add(row);
}
}
catch (IOException ex) {
throw new RuntimeException("Error in reading CSV file: "+ex);
}
finally {
try {
inputStream.close();
}
catch (IOException e) {
throw new RuntimeException("Error while closing input stream: "+e);
}
}
return resultList;
}
}