62,628
社区成员
发帖
与我相关
我的任务
分享
for(File temp : sub){
String tempName = temp.getName();//子文件的名字
if(temp.isDirectory()){
copyDirector(temp,makePath);
}
if(temp.isFile()){
try {
a1 = new FileInputStream(temp);
b2 = new FileOutputStream(newPath+"\\"+tempName);
byte[] x = new byte[1024*1024];
int readCound = 0;
while ((readCound=a1.read(x)) != -1){
b2.write(x,0,readCound);
}
b2.flush();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}finally {
try {
a1.close();
} catch (IOException e) {
e.printStackTrace();
}
try {
b2.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
public class Hello {
private String name;
}