yarfraw.utils.reader
Class FeedReaderUtils

java.lang.Object
  extended by yarfraw.utils.reader.FeedReaderUtils

public class FeedReaderUtils
extends Object


Method Summary
static ChannelFeed read(FeedFormat format, File file)
          Read a Rss feed in to a ChannelFeed data object.
static List<ChannelFeed> readAll(ExecutorService executorService, org.apache.commons.httpclient.HttpURL... urls)
          Static method for reading feed(s) remotely.
static List<ChannelFeed> readAll(FeedFormat format, File... files)
          Read all Rss feed and return them in a list that is in the same order.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

readAll

public static List<ChannelFeed> readAll(ExecutorService executorService,
                                        org.apache.commons.httpclient.HttpURL... urls)
                                 throws YarfrawException
Static method for reading feed(s) remotely. This method will submit a Callable object to the input ExecutorService for every input url and will only return when it finishes reading all requested feeds. The ChannelFeeds in the returned list will in the exact same order as the input url. If for whatever reasons the method fails to read a feed, the corresponding ChannelFeed in the list will be null.
This method will detect the formats automatically, but since it does not remember any states, it has to performance format detection every time it is called. It is recommended that you keep an instance of the reader in memory so the reader can re-use the detected formats.

Parameters:
files - - Files pointing to Rss feed files.
executorService - - @see ExecutorService
urls - - @see HttpURL
Returns:
- a list of ChannelFeed
Throws:
YarfrawException - - If there is a failure reading any of the feeds.

readAll

public static List<ChannelFeed> readAll(FeedFormat format,
                                        File... files)
                                 throws YarfrawException
Read all Rss feed and return them in a list that is in the same order.

Parameters:
files - - Files pointing to Rss feed files.
format - - FeedFormat
Returns:
- a list of ChannelFeed
Throws:
YarfrawException - - If there is a failure reading any of the feeds.

read

public static ChannelFeed read(FeedFormat format,
                               File file)
                        throws YarfrawException
Read a Rss feed in to a ChannelFeed data object.

Parameters:
file - - File pointing to a Rss feed file.
format - - FeedFormat
Returns:
- A ChannelFeed data object representation of the feed.
Throws:
YarfrawException - - If there is a failure reading the feeds.


Copyright © 2008. All Rights Reserved.