public static String copy(File from, File to, String eol, Map keywords, MessageDigest digest) { InputStream is = null; OutputStream os = null; if (!from.exists()) { return null; } else if (!to.exists()) { to.getParentFile().mkdirs(); try { to.createNewFile(); } catch (IOException e1) { return null; } } FSUtil.setReadonly(to, false); try { is = new BufferedInputStream(new FileInputStream(from)); os = new BufferedOutputStream(new FileOutputStream(to)); return copy(is, os, eol, keywords, digest); } catch (IOException e) { e.printStackTrace(); } finally { if (os != null) { try { os.close(); } catch (IOException e1) {} } if (is != null) { try { is.close(); } catch (IOException e1) {} } } return null;
public static String copy(InputStream is, OutputStream os, MessageDigest digest) throws IOException { return FSUtil.copy(is, os, null, digest);
    public static String copy(File from, File to, String eol, Map keywords, MessageDigest digest) {        InputStream is = null;        OutputStream os = null;        if (!from.exists()) {            return null;        } else if (!to.exists()) {            to.getParentFile().mkdirs();            try {                to.createNewFile();            } catch (IOException e1) {                return null;            }        }        FSUtil.setReadonly(to, false);        try {            is = new BufferedInputStream(new FileInputStream(from));            os = new BufferedOutputStream(new FileOutputStream(to));            return copy(is, os, eol, keywords, digest);        } catch (IOException e) {            e.printStackTrace();        } finally {            if (os != null) {                try {                    os.close();                } catch (IOException e1) {}            }            if (is != null) {                try {                    is.close();                } catch (IOException e1) {}            }        }        return null;    }