小乐迷2004-12-20 18:56:48
我要用java编一个程序,从三个不同的文件中读取数据,但是每次只读每个文件的一部分,调用一个小程序后换下一个文件做同样的工作,然后再接着往下读,直到读完为止.大概步骤如下:

int id,
string line;

line = read file1
while (line!=null)
{
if(line starts with id) // 1st block
{
run process1;
line = read file1;
}
else line = read file2
{
if(line starts with id)
{
run process1;
line = read file2;
}
else line = read file3
{
if(line starts with id)
{
run process1;
line = read file3;
}
else
{
run process2;
id++;
line = read file1;
goto 1st block above;
}
}
}
}

我的想法是建一个读文件的bufferedReader数组,数组1针对文件1,以此类推,但问题是怎么loop好呢?我好象一遇到循环就头疼!

还有查到了一个程式是用来标读取位置的,但看不明白该怎么设它的参数:void mark(int readAheadLimit), 怎么定readAheadLimit的值呢?

恭请高手帮忙吧!多谢多谢!