public static void copy(URL src, File dst) throws IOException {

        try (InputStream in = src.openStream()) {
            try (OutputStream out = new FileOutputStream(dst)) {
                dst.mkdirs();
                copy(in, out);
            }
        }
    }
Copies the contents at <CODE>src</CODE> to <CODE>dst</CODE>.
@param src the source location
@param dst the target location
@throws IOException if the copy failed
xmppserver/src/main/java/org/jivesoftware/util/WebManager.java