01: /*---------------------------------------------------------------------------*\
02: $Id: RSSParser.java 7041 2007-09-09 01:04:47Z bmc $
03: ---------------------------------------------------------------------------
04: This software is released under a BSD-style license:
05:
06: Copyright (c) 2004-2007 Brian M. Clapper. All rights reserved.
07:
08: Redistribution and use in source and binary forms, with or without
09: modification, are permitted provided that the following conditions are
10: met:
11:
12: 1. Redistributions of source code must retain the above copyright notice,
13: this list of conditions and the following disclaimer.
14:
15: 2. The end-user documentation included with the redistribution, if any,
16: must include the following acknowlegement:
17:
18: "This product includes software developed by Brian M. Clapper
19: (bmc@clapper.org, http://www.clapper.org/bmc/). That software is
20: copyright (c) 2004-2007 Brian M. Clapper."
21:
22: Alternately, this acknowlegement may appear in the software itself,
23: if wherever such third-party acknowlegements normally appear.
24:
25: 3. Neither the names "clapper.org", "curn", nor any of the names of the
26: project contributors may be used to endorse or promote products
27: derived from this software without prior written permission. For
28: written permission, please contact bmc@clapper.org.
29:
30: 4. Products derived from this software may not be called "curn", nor may
31: "clapper.org" appear in their names without prior written permission
32: of Brian M. Clapper.
33:
34: THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
35: WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
36: MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
37: NO EVENT SHALL BRIAN M. CLAPPER BE LIABLE FOR ANY DIRECT, INDIRECT,
38: INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
39: NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
40: DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
41: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
42: (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
43: THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
44: \*---------------------------------------------------------------------------*/
45:
46: package org.clapper.curn.parser;
47:
48: import java.io.IOException;
49: import java.io.InputStream;
50:
51: import java.net.URL;
52:
53: /**
54: * This interface defines a simplified view of an RSS parser, providing
55: * only the methods necessary for <i>curn</i> to work. <i>curn</i> uses
56: * the {@link RSSParserFactory} class to get a specific implementation of
57: * an <tt>RSSParser</tt>. This strategy isolates the bulk of the code from
58: * the underlying RSS parser, making it easier to substitute different
59: * parsers as more of them become available.
60: *
61: * @see RSSParserFactory
62: * @see RSSChannel
63: * @see RSSItem
64: *
65: * @version <tt>$Revision: 7041 $</tt>
66: */
67: public interface RSSParser {
68: /*----------------------------------------------------------------------*\
69: Public Methods
70: \*----------------------------------------------------------------------*/
71:
72: /**
73: * Parse an RSS feed.
74: *
75: * @param url the URL for the feed
76: * @param stream the <tt>InputStream</tt> for the feed
77: * @param encoding the encoding of the data in the field, if known, or
78: * null
79: *
80: * @return an <tt>RSSChannel</tt> object representing the RSS data from
81: * the site.
82: *
83: * @throws IOException unable to read from URL
84: * @throws RSSParserException unable to parse RSS XML
85: */
86: public RSSChannel parseRSSFeed(URL url, InputStream stream,
87: String encoding) throws IOException, RSSParserException;
88: }
|