import java.io.*;
public class IOTestThree {
private FileInputStream fileInputStream;
private FileOutputStream outputStream;
IOTestThree(String name,String ...strings ) throws Exception{
int length = strings.length;
if (length==0) {
throw new Exception("请至少指定一个目标文件");
}else {
for (int i = 0; i < strings.length; i++) {
fileInputStream=new FileInputStream(name);
outputStream = new FileOutputStream(strings[i]);
byte [] b=new byte[1024];
while (-1!=fileInputStream.read(b)) {
outputStream.write(b);
}
fileInputStream.close();
outputStream.flush();
outputStream.close();
}
}
}
public static void main(String[] args) {
try {
new IOTestThree("a.txt", "a1.txt","a2.txt","a3.txt","a4.txt");
} catch (Exception e) {
e.printStackTrace();
}
}
}