1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.sun.syndication.samples;
18
19 import java.net.URL;
20 import com.sun.syndication.feed.synd.SyndFeedI;
21 import com.sun.syndication.io.SyndInput;
22
23 /***
24 * It Reads and prints any RSS/Atom feed type.
25 * <p>
26 * @author Alejandro Abdelnur
27 *
28 */
29 public class FeedReader {
30
31 public static void main(String[] args) {
32 boolean ok = false;
33 if (args.length==1) {
34 try {
35 URL feedUrl = new URL(args[0]);
36
37 SyndInput input = new SyndInput();
38 SyndFeedI feed = input.build(feedUrl.openStream());
39
40 System.out.println(feed);
41
42 ok = true;
43 }
44 catch (Exception ex) {
45 System.out.println("ERROR: "+ex.getMessage());
46 }
47 }
48
49 if (!ok) {
50 System.out.println();
51 System.out.println("FeedReader reads and prints any RSS/Atom feed type.");
52 System.out.println("The first parameter must be the URL of the feed to read.");
53 System.out.println();
54 }
55 }
56
57 }