import java.io.*;
import java.util.*;
class SequenceDemo
{
public static void main(String[] args) throws IOException
{
Vector<FileInputStream>v=new Vector<FileInputStream>();
v.add(new FileInputStream("aa.txt"));
v.add(new FileInputStream("bb.txt"));
v.add(new FileInputStream("cc.txt"));
Enumeration<FileInputStream>en=v.elements();
SequenceInputStream sis=new SequenceInputStream(en);
FileOutputStream fos=new FileOutputStream("dd.txt");
byte[] buf=new byte[1024];
int len=0;
while((len=sis.read(buf))!=-1)
{
fos.write(buf,0,len);
}
fos.close();
sis.close();
}
}
为什么这段程序将aa.txt文件中的数据写入到dd.txt后,在录入bb.txt文件里的数据时,不换行???dd.txt中的数据如下图,毕老师的是换了行,很整齐的,why,求解!!!
|
|