伙计们,
我有一段代码可以搜索一些类似的 .ser 文件并将它们加载到列表中
文件是(rulesIncr1.ser、rulesIncr2.ser、rulesIncr3.ser ......等等)
现在加载所有文件,我编写了以下逻辑
String defaultfilename = "rulesincr";
int i=1;
String incrFile;
//THE FOLLOWING CODE WILL CHECK FOR ANY NU8MBER OF INCR RULES FILE IN THE LOCATION AND ADD THEM TO A RULE MODEL LIST
do
{
String tempincr = new Integer(i).toString();
incrFile = defaultfilename.concat(tempincr).concat(".ser");
FileInputStream fis= new FileInputStream( filePath.concat(incrFile));
ObjectInputStream inStreamIncr = new ObjectInputStream(fis);
myRulesIncr = (List<RuleModel>)inStreamIncr.readObject();
i++;
}
while(new File(filePath.concat(incrFile)).isFile());
现在我面临的问题是每次刷新 myRulesIncr 并且最后只加载最后一个文件。我需要拥有所有加载的文件。请指教
谢谢