第十九天总结
1.IO包中的其他类:
打印流:
PrintStream
PrintWriter
序列流
import java.io.*;
import java.util.*;
class SequenceInputStreamDemo
{
public static void main(String[] args) throws
IOException
{
ArrayList<FileInputStream> lis=new
ArrayList<FileInputStream>();
for (int x=1;x<=3 ;x++ )
{
lis.add(new FileInputStream(x+".txt"));
}
final Iterator<FileInputStream>
it=lis.iterator();
Enumeration<FileInputStream> en=new
Enumeration<FileInputStream>()
{
public boolean hasMoreElements()
{
return it.hasNext();
}
public FileInputStream nextElement()
{
return it.next();
}
};
SequenceInputStream sis=new
SequenceInputStream(en);
FileOutputStream fos=new FileOutputStream
("4.txt");
byte[] buf=new byte[1024];
int num=0;
while ((num=sis.read(buf))!=-1)
{
fos.write(buf,0,num);
}
fos.close();
sis.close();
}
public static void sipltFile()
{
FileOutputStream fos=new FileOutputStream()
}
}