com.sun.syndication.io
Class FeedOutput

java.lang.Object
  extended bycom.sun.syndication.io.FeedOutput

public class FeedOutput
extends java.lang.Object

Generates an XML document (String, File, OutputStream, Writer, W3C DOM document or JDOM document) out of an AbstractFeed (RSS/Atom).

It generates all flavors of RSS (0.90, 0.91, 0.92, 0.93, 0.94, 1.0 and 2.0) and Atom 0.3 feeds. Generators are plugable (they must implement the ModuleParser interface).

Author:
Alejandro Abdelnur

Constructor Summary
FeedOutput(java.lang.String type)
          Creates a FeedOuput instace for a given feed type.
 
Method Summary
static java.util.List getSupportedFeedTypes()
          Returns the list of supported output feed types.
 java.lang.String getType()
          Returns the type of feed the FeedOutput creates.
 org.w3c.dom.Document ouptutW3CDom(AbstractFeed feed)
          Creates a W3C DOM document for the given AbstractFeed.
 void output(AbstractFeed feed, java.io.File file)
          Creates a File containing with the XML representation for the given AbstractFeed.
 void output(AbstractFeed feed, java.io.OutputStream os)
          Writes to an OutputStream the XML representation for the given AbstractFeed.
 void output(AbstractFeed feed, java.io.Writer writer)
          Writes to an Writer the XML representation for the given AbstractFeed.
 org.jdom.Document outputJDom(AbstractFeed feed)
          Creates a JDOM document for the given AbstractFeed.
 java.lang.String outputString(AbstractFeed feed)
          Creates a String with the XML representation for the given AbstractFeed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FeedOutput

public FeedOutput(java.lang.String type)
Creates a FeedOuput instace for a given feed type.

Parameters:
type - the type of feed to generate.
Method Detail

getSupportedFeedTypes

public static java.util.List getSupportedFeedTypes()
Returns the list of supported output feed types.

Returns:
a list of String elements with the supported output feed types.
See Also:
for details on the format of these strings.


getType

public java.lang.String getType()
Returns the type of feed the FeedOutput creates.

Returns:
the type of feed this FeedOutput creates.

outputString

public java.lang.String outputString(AbstractFeed feed)
                              throws java.lang.IllegalArgumentException,
                                     FeedException
Creates a String with the XML representation for the given AbstractFeed.

NOTE: This method delages to the 'Document FeedOutput#outputJDom(AbstractFeed)'.

Parameters:
feed - Abstract feed to create XML representation from. The type of the AbstractFeed must match the type given to the FeedOuptut constructor.
Returns:
a String with the XML representation for the given AbstractFeed.
Throws:
java.lang.IllegalArgumentException - thrown if the feed type of the FeedOutput and AbstractFeed don't match.
FeedException - thrown if the XML representation for the feed could not be created.

output

public void output(AbstractFeed feed,
                   java.io.File file)
            throws java.lang.IllegalArgumentException,
                   java.io.IOException,
                   FeedException
Creates a File containing with the XML representation for the given AbstractFeed.

NOTE: This method delages to the 'Document FeedOutput#outputJDom(AbstractFeed)'.

Parameters:
feed - Abstract feed to create XML representation from. The type of the AbstractFeed must match the type given to the FeedOuptut constructor.
file - the file where to write the XML representation for the given AbstractFeed.
Throws:
java.lang.IllegalArgumentException - thrown if the feed type of the FeedOutput and AbstractFeed don't match.
java.io.IOException - thrown if there was some problem writing to the File.
FeedException - thrown if the XML representation for the feed could not be created.

output

public void output(AbstractFeed feed,
                   java.io.OutputStream os)
            throws java.lang.IllegalArgumentException,
                   java.io.IOException,
                   FeedException
Writes to an OutputStream the XML representation for the given AbstractFeed.

NOTE: This method delages to the 'Document FeedOutput#outputJDom(AbstractFeed)'.

Parameters:
feed - Abstract feed to create XML representation from. The type of the AbstractFeed must match the type given to the FeedOuptut constructor.
os - OutputStream to write the XML representation for the given AbstractFeed.
Throws:
java.lang.IllegalArgumentException - thrown if the feed type of the FeedOutput and AbstractFeed don't match.
java.io.IOException - thrown if there was some problem writing to the OutputStream.
FeedException - thrown if the XML representation for the feed could not be created.

output

public void output(AbstractFeed feed,
                   java.io.Writer writer)
            throws java.lang.IllegalArgumentException,
                   java.io.IOException,
                   FeedException
Writes to an Writer the XML representation for the given AbstractFeed.

NOTE: This method delages to the 'Document FeedOutput#outputJDom(AbstractFeed)'.

Parameters:
feed - Abstract feed to create XML representation from. The type of the AbstractFeed must match the type given to the FeedOuptut constructor.
writer - Writer to write the XML representation for the given AbstractFeed.
Throws:
java.lang.IllegalArgumentException - thrown if the feed type of the FeedOutput and AbstractFeed don't match.
java.io.IOException - thrown if there was some problem writing to the Writer.
FeedException - thrown if the XML representation for the feed could not be created.

ouptutW3CDom

public org.w3c.dom.Document ouptutW3CDom(AbstractFeed feed)
                                  throws java.lang.IllegalArgumentException,
                                         FeedException
Creates a W3C DOM document for the given AbstractFeed.

NOTE: This method delages to the 'Document FeedOutput#outputJDom(AbstractFeed)'.

Parameters:
feed - Abstract feed to create W3C DOM document from. The type of the AbstractFeed must match the type given to the FeedOuptut constructor.
Returns:
the W3C DOM document for the given AbstractFeed.
Throws:
java.lang.IllegalArgumentException - thrown if the feed type of the FeedOutput and AbstractFeed don't match.
FeedException - thrown if the W3C DOM document for the feed could not be created.

outputJDom

public org.jdom.Document outputJDom(AbstractFeed feed)
                             throws java.lang.IllegalArgumentException,
                                    FeedException
Creates a JDOM document for the given AbstractFeed.

NOTE: All other output methods delegate to this method.

Parameters:
feed - Abstract feed to create JDOM document from. The type of the AbstractFeed must match the type given to the FeedOuptut constructor.
Returns:
the JDOM document for the given AbstractFeed.
Throws:
java.lang.IllegalArgumentException - thrown if the feed type of the FeedOutput and AbstractFeed don't match.
FeedException - thrown if the JDOM document for the feed could not be created.


Copyright © 2004 Sun Microsystems. All Rights Reserved.