package com.amalgam.io;

import java.io.File;

/**
 * Created by yokomakukeishin on 2013/11/16.
 */
public final class FileUtils {
    private FileUtils() {}

    public static final boolean makeDirsIfNeeded(File dir) {
        if (dir.exists()) {
            return false;
        }
        return dir.mkdirs();
    }
}

@@ -43,61 +43,177 @@
 le;%0A
-%0A/**%0A * Created by yokomakukeishin on 2013/11/16.%0A */
+import java.io.FileInputStream;%0Aimport java.io.FileNotFoundException;%0Aimport java.io.FileOutputStream;%0Aimport java.io.IOException;%0Aimport java.nio.channels.FileChannel;%0A
 %0Apub
@@ -428,10 +428,914 @@
 ;%0A    %7D%0A
-%7D
 %0A
+    public static final long copy(File source, File destination) throws FileNotFoundException, IOException %7B%0A        FileInputStream in = null;%0A        FileOutputStream out = null;%0A        try %7B%0A            in = new FileInputStream(source);%0A            out = new FileOutputStream(destination);%0A            return copy(in, out);%0A        %7D finally %7B%0A            CloseableUtils.close(in);%0A            CloseableUtils.close(out);%0A        %7D%0A    %7D%0A%0A    public static final long copy(FileInputStream in, FileOutputStream out) throws IOException %7B%0A        FileChannel source = null;%0A        FileChannel destination = null;%0A        try %7B%0A            source = in.getChannel();%0A            destination = out.getChannel();%0A            return source.transferTo(0, source.size(), destination);%0A        %7D finally %7B%0A            CloseableUtils.close(source);%0A            CloseableUtils.close(destination);%0A        %7D%0A    %7D%0A%7D

Append file copy utility