codice:
    try{
        URL u = new URL("http://127.0.0.1/temp.pdf");
        InputStream is = u.openStream();
        FileOutputStream fos = new FileOutputStream("c:/temp.pdf");
        int c=0;
        while((c=is.read())!= -1){
            fos.write(c);
        }

        fos.close();
    }catch(Exception e){
        System.out.println("Eccezione: " + e.toString());
    }