dimanche 6 décembre 2015

How to download and read a file from a web site without having web browser?

If a user don't have any web browser, which java code he should write (and which classes he needs) to download and read file? Lets say that this is the URL where the file will be downloaded: http://ift.tt/1LWrjj4

So far I have tried to access a url, but in order to download a file what procedure I should follow.

package filedownload;
import java.awt.Desktop;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;


public class FileDownload {

public static void main(String[] args) throws URISyntaxException, IOException {

    Desktop d=Desktop.getDesktop();

    d.browse(new URI("http://ift.tt/1LWrjj4"));

    }

}

Aucun commentaire:

Enregistrer un commentaire