所以我有这个代码以及MyApplicationProject / assets中的文本文件。我正在尝试阅读它并将其放入按行分割的2d数组和','我不断获得IOException。提前谢谢
public String[][] stopData() throws IOException {
AssetManager assetManager = getAssets();
InputStream input;
input = assetManager.open("stops.txt");
int size = input.available();
byte[] buffer = new byte[size];
input.read(buffer);
input.close();
String content = new String(buffer);
String[] lines = content.split("/n");
String[][] stopData = new String[lines.length][];
for (int i=0; i < lines.length; i++) {
stopData[i] = lines[i].split(",");
if (stopData[i].length != 9 ) {
Log.d(TAG,"odd length " + stopData.toString() );
}
}
return stopData;
}