de.nava.informa.utils
Class FormatDetector

java.lang.Object
  extended by de.nava.informa.utils.FormatDetector

public final class FormatDetector
extends Object

Utility class for analysing the news channel syntax and mapping to known format to ease further processing.

Author:
Niko Schmuck (niko@nava.de)

Constructor Summary
FormatDetector()
           
 
Method Summary
static ChannelFormat getFormat(InputStream in)
          Guess the format of the specified news channel.
static ChannelFormat getFormat(URL url)
          Guess the format of the specified news channel.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FormatDetector

public FormatDetector()
Method Detail

getFormat

public static ChannelFormat getFormat(URL url)
                               throws IOException,
                                      UnsupportedFormatException
Guess the format of the specified news channel. For performance reason it is wise to minimize the number of format guesses.

Parameters:
url - a url to the news channel.
Returns:
The news channel synatx format, currently only RSS 0.91 (ChannelFormat.RSS_0_91) and RSS/RDF 1.0 (ChannelFormat.RSS_1_0) are recognized.
Throws:
UnsupportedFormatException - in case a news channel format could not be guessed.
IOException - if the given url cannot be read in.

getFormat

public static ChannelFormat getFormat(InputStream in)
                               throws IOException,
                                      UnsupportedFormatException
Guess the format of the specified news channel. For performance reason it is wise to minimize the number of format guesses.

Parameters:
in - an InputStream to the news channel.
Returns:
The news channel synatx format, currently only RSS 0.91 (ChannelFormat.RSS_0_91) and RSS/RDF 1.0 (ChannelFormat.RSS_1_0) are recognized.
Throws:
UnsupportedFormatException - in case a news channel format could not be guessed.
IOException - if the given url cannot be read in.


Copyright © 2002-2007 Niko Schmuck. All Rights Reserved.