public static ArrayList ReadSqlConfing(String str) throws FileNotFoundException, IOException{
FileReader myFileReader=new FileReader(str);
BufferedReader myBufferedReader=new BufferedReader(myFileReader);
String myString=null;
ArrayList<String []> myal=new ArrayList<String []>();
String mysql="";
String filename="";
//tempal[0]="";
//tempal[1]="";
//String tmpstr[]=new String[2];
/*while((myString=myBufferedReader.readLine())!=null)
{ System.out.println(myString);
}*/
int i=0;
while((myString=myBufferedReader.readLine())!=null)
{ //System.out.println(myString.indexOf("//-->"));
if(myString.indexOf("//-->")>=0){
filename=myString.replace("//-->","");//取得要保存的文件名
//System.out.println(filename);
String tempal[]=new String[2];
tempal[0]=mysql;
tempal[1]=filename;
//myal.add(i,new String[2]);
myal.add(i,tempal);
i++;
System.out.println("i="+i+" filename="+filename+" ");
mysql="";
filename="";
tempal[0]="";
tempal[1]="";
}
else{
mysql=mysql+myString;
}
}
myFileReader.close();
for(int m=0;m<myal.size();m++){
String tempal[]=new String[2];
tempal= (String[])myal.get(m);
System.out.println(tempal[0]);
System.out.println(tempal[1]);
}
return myal;
}
这段代码为什么在最后打出来的tempal[0]和tempal[1]都是空呢? |