백엔드
Java File copy with append if exits file
팩트폭력배
2012. 11. 14. 14:31
import org.apache.commons.io.IOUtils;
private void copy(File source, File target){
try {
in = new FileInputStream(source);
out = new FileOutputStream(target, true);
IOUtils.copy(in, out);
} catch (IOException ex) {
ex.printStackTrace();
} finally {
IOUtils.closeQuietly(in);
IOUtils.closeQuietly(out);
}
}
FileOutputStream의 생성자 중 두번째 인자는 append 여부.