0
哎Ive得到這裏的代碼塊試圖讀取在.csv文件中的單個行:存儲單CSV線對象成陣列
行=新WarehouseItem [];
public void readCSV(String filename) {
FileInputStream fileStrm = null;
InputStreamReader rdr;
BufferedReader bufRdr;
int lineNum;
String line;
try {
fileStrm = new FileInputStream(filename);
rdr = new InputStreamReader(fileStrm);
bufRdr = new BufferedReader(rdr);
numRows = 0;
line = bufRdr.readLine();
while (line != null) {
rows[numRows] = line;
numRows++;
line = bufRdr.readLine();
}
fileStrm.close();
}
catch (IOException e) {
if (fileStrm != null) {
try {
fileStrm.close();
} catch (IOException ex2) {}
}
System.out.println("Error in file processing: " + e.getMessage());
}
}
在rows[numRows] = line
即時試圖行存儲到對象的數組(我有預製包含字符串數組和列的數量的對象)
即時沒有完全確定如何存儲單線即時通訊試圖讀取我的對象。
任何幫助將是非常讚賞:)如果你使用一個CSV庫做這個
rows'的'的聲明從您的代碼段丟失。我們需要看到這一點。 –
你需要告訴我們什麼'行'_is_。它是一個String []嗎?一個String [] []'? –