如果我执行这个程序来解析文本文件并找到一些包含 01:09;ppp;RR:20552,40014,30141,20412,60062,20442,20362,20352,40017,40063,20402,20342 的代码, 40532,40231,40512,20792,10441,40542;作为文本然后我得到 arrayoutofbounderror 那么是什么原因
package FileParser;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
public class ParsingFile {
public static void main(String args[]) {
// TODO Auto-generated method stub
String filename = null;
ArrayList<String> l=new ArrayList<String>();
System.out.println("Enter the file name");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try {
filename = br.readLine();
System.out.println("Filename entered is :" + filename);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
FileReader reader = new FileReader(filename);
BufferedReader buf = new BufferedReader(reader);
String data;
while ((data = buf.readLine()) != null)
{
String[] text1 = data.split(";RR:");
String[] text2 = text1[1].split(";");
String[] text3 = text2[0].split(",");
for (String e:text3) {
l.add(e);
System.out.println(e);
}
}
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// parseJson(l);
}
/*public static void parseJson(ArrayList l)
{
}*/
}