한 디렉터리에서 다른 디렉터리로 이미지를 복사하는 기능을 Java로 작성했습니다. IOException
, 즉 C:\Documents and Settings\Admin\Desktop\C.V (Access is denied)
을 던집니다. 무엇이 문제 일 수 있습니다.한 디렉터리에서 다른 디렉터리로 이미지를 복사하는 방법
public void copyImageFiles(File sourceFile, File destinationDir) throws IOException {
FileInputStream fis = new FileInputStream(sourceFile);
FileOutputStream fos = new FileOutputStream(destinationDir);
FileChannel srcChannel = fis.getChannel();
FileChannel destChannel = fos.getChannel();
srcChannel.transferTo(0, sourceFile.length(), destChannel);
srcChannel.close();
destChannel.close();
fis.close();
fos.close();
}