Biblioteca Java - Blame information for rev 3
Subversion Repositories:
Rev | Author | Line No. | Line |
---|---|---|---|
3 | mihai | 1 | /* |
2 | * ContentDownloader.java | ||
3 | */ | ||
4 | package lab.scd.net.url_http; | ||
5 | |||
6 | import java.io.IOException; | ||
7 | import java.net.MalformedURLException; | ||
8 | import java.net.URL; | ||
9 | |||
10 | /** | ||
11 | * Class created by @author Mihai HULEA at Feb 25, 2005. | ||
12 | * | ||
13 | * This class is part of the laborator2_net project. | ||
14 | * | ||
15 | * Aplicatia prezinta un alt mod prin care se pot downloada resurse. Este folosita | ||
16 | * metoda getContent() din cadrul clasei URL. | ||
17 | */ | ||
18 | public class ContentDownloader { | ||
19 | |||
20 | public static void main (String[] args) { | ||
21 | String url = "http://utcluj.ro/index.html"; | ||
22 | // Open the URL for reading | ||
23 | try { | ||
24 | URL u = new URL(args[0]); | ||
25 | try { | ||
26 | Object o = u.getContent( ); | ||
27 | System.out.println("I got a " + o.getClass().getName( )); | ||
28 | } // end try | ||
29 | catch (IOException e) { | ||
30 | System.err.println(e); | ||
31 | } | ||
32 | } // end try | ||
33 | |||
34 | catch (MalformedURLException e) { | ||
35 | System.err.println(args[0] + " is not a parseable URL"); | ||
36 | } | ||
37 | |||
38 | |||
39 | } // end main | ||
40 | } |