de.nava.informa.utils
Class FormatDetector
java.lang.Object
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)
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FormatDetector
public FormatDetector()
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.