import java.io.*;
public class z15 {
public static void main(String[] args) {
///카피해서 두는 방법
for(int i=0;i<100;i++) {
String originfilenm = "/Users/eunsukkim/Downloads/1.jpeg";
String copyFilename = "/Users/eunsukkim/Downloads/1" + i + "cop2y.jpeg";
try {
InputStream is = new FileInputStream(originfilenm);
OutputStream os = new FileOutputStream(copyFilename);
// byte[] readdata = new byte[1024];
//
// while(true){
//
// int cnt = is.read(readdata);
//
// if(cnt == -1){
// break;
// }
//
// os.write(readdata);
//
// }
is.transferTo(os);
os.flush();
is.close();
os.close();
} catch (FileNotFoundException e) {
throw new RuntimeException(e);
} catch (IOException io) {
System.out.println(io.getMessage());
}
}
}
}
댓글 영역