public void copy(String originPath, String resultPath, String resultFileName) {
File origin = new File(originPath);
File resultDir = new File(resultPath);
resultDir.mkdirs();
File result = new File(resultPath + "/" + resultFileName);
FileInputStream input;
FileOutputStream output;
FileChannel originChanel;
FileChannel resultChanel;
try {
input = new FileInputStream(origin);
output = new FileOutputStream(result);
originChanel = input.getChannel();
resultChanel = output.getChannel();
originChanel.transferTo(0, originChanel.size(), resultChanel);
originChanel.close();
resultChanel.close();
input.close();
output.close();
} catch (Exception e) {
}
}
originPath - 원본 파일 경로 및 파일 이름
resultPath - 저장할 경로
resultFileName - 저장할 파일 이름
'android tech.' 카테고리의 다른 글
파일 지우기 (0) | 2014.05.02 |
---|---|
파일이 있는지 체크하기 (0) | 2014.05.02 |
bitmap을 png 또는 jpg 파일로 저장 (0) | 2014.05.02 |
파일다운로드 및 저장 (0) | 2014.05.02 |
layout에서 round rect 그리기 (0) | 2014.05.02 |