is = SFClassLoader.getResourceAsStream(url);
URL endpoint=new URL(url); is = endpoint.openStream();
    public static void download(String url, File localFile, int blocksize)            throws IOException {        /** FileOutputStream object. */        FileOutputStream fs = null;        /** InputStream. */        InputStream is = null;        byte[] b = new byte[blocksize];        int bytesRead;        boolean finished=false;        //create our output directories.        localFile.getParentFile().mkdirs();        try {            // open the URL,            is = SFClassLoader.getResourceAsStream(url);            // open the file,            fs = new FileOutputStream(localFile);            // transfer the data            do {                bytesRead = is.read(b, 0, blocksize);                if (bytesRead > 0) {                    fs.write(b, 0, bytesRead);                }            } while (bytesRead > 0);            //mark as finished            finished=true;            fs.close();        } finally {            FileSystem.close(fs);            FileSystem.close(is);            //delete any half-downloaded local file if            //something went wrong during download.            if(!finished && localFile.exists()) {                localFile.delete();            }        }    }