|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.clapper.curn.output.FileOutputHandler
public abstract class FileOutputHandler
FileOutputHandler is an abstract base class for OutputHandler subclasses that write RSS feed summaries to a file. It consolidates common logic and configuration handling for such classes, providing both consistent implementation and configuration.
OutputHandler,
Curn,
RSSChannel| Field Summary | |
|---|---|
static java.lang.String |
CFG_ENCODING
Configuration variable: encoding |
static java.lang.String |
CFG_SAVE_AS
Where to save the output, if any |
static java.lang.String |
CFG_SAVE_ONLY
Whether we're ONLY saving output |
static java.lang.String |
CFG_SAVED_BACKUPS
Number of backups of saved files to keep. |
static java.lang.String |
CFG_SHOW_CURN_INFO
Whether or not to show curn information |
| Constructor Summary | |
|---|---|
FileOutputHandler()
Construct a new FileOutputHandler |
|
| Method Summary | |
|---|---|
abstract void |
displayChannel(RSSChannel channel,
FeedInfo feedInfo)
Display the list of RSSItem news items to whatever output is defined for the underlying class. |
protected boolean |
displayToolInfo()
Determine whether or not to display curn tool-related information in the generated output. |
abstract void |
flush()
Flush any buffered-up output. |
abstract java.lang.String |
getContentType()
Get the content (i.e., MIME) type for output produced by this output handler. |
java.io.File |
getGeneratedOutput()
Get the File that represents the output produced by the handler, if applicable. |
java.lang.String |
getName()
Get the name of this output handler. |
java.lang.String |
getOutputEncoding()
Get the output encoding. |
protected java.io.File |
getOutputFile()
Get the output file. |
boolean |
hasGeneratedOutput()
Determine whether this handler has produced any actual output (i.e., whether getGeneratedOutput() will return a non-null
File if called). |
void |
init(CurnConfig config,
ConfiguredOutputHandler cfgHandler)
Initializes the output handler for another set of RSS channels. |
abstract void |
initOutputHandler(CurnConfig config,
ConfiguredOutputHandler cfgHandler)
Perform any subclass-specific initialization. |
protected java.io.PrintWriter |
openOutputFile()
Open the output file, returning a PrintWriter. |
protected boolean |
savingOutputOnly()
Determine whether the handler is saving output only, or also reporting output to curn. |
void |
setName(java.lang.String name)
Set the name of this output handler. |
protected void |
setOutputEncoding(java.lang.String newEncoding)
Override the encoding specified by the CFG_ENCODING
configuration parameter. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String CFG_ENCODING
public static final java.lang.String CFG_SHOW_CURN_INFO
public static final java.lang.String CFG_SAVE_AS
public static final java.lang.String CFG_SAVE_ONLY
public static final java.lang.String CFG_SAVED_BACKUPS
| Constructor Detail |
|---|
public FileOutputHandler()
| Method Detail |
|---|
public java.lang.String getName()
getName in interface OutputHandler
public void setName(java.lang.String name)
throws CurnException
setName in interface OutputHandlername - the name
CurnException - on error
public final void init(CurnConfig config,
ConfiguredOutputHandler cfgHandler)
throws org.clapper.util.config.ConfigurationException,
CurnException
init in interface OutputHandlerconfig - the parsed curn configuration datacfgHandler - the ConfiguredOutputHandler wrapper
containing this object; the wrapper has some useful
metadata, such as the object's configuration section
name and extra variables.
org.clapper.util.config.ConfigurationException - configuration error
CurnException - some other initialization errorCurnConfig,
ConfiguredOutputHandler
public abstract void initOutputHandler(CurnConfig config,
ConfiguredOutputHandler cfgHandler)
throws org.clapper.util.config.ConfigurationException,
CurnException
config - the parsed curn configuration datacfgHandler - the ConfiguredOutputHandler wrapper
containing this object; the wrapper has some useful
metadata, such as the object's configuration section
name and extra variables.
org.clapper.util.config.ConfigurationException - configuration error
CurnException - some other initialization error
public abstract void displayChannel(RSSChannel channel,
FeedInfo feedInfo)
throws CurnException
init() method.
displayChannel in interface OutputHandlerchannel - The parsed channel datafeedInfo - The feed.
CurnException - unable to write output
public abstract void flush()
throws CurnException
flush in interface OutputHandlerCurnException - unable to write outputpublic abstract java.lang.String getContentType()
getContentType in interface OutputHandlerOutputHandler.hasGeneratedOutput(),
OutputHandler.getGeneratedOutput()
public final java.io.File getGeneratedOutput()
throws CurnException
getGeneratedOutput in interface OutputHandlerCurnException - an error occurredpublic java.lang.String getOutputEncoding()
getOutputEncoding in interface OutputHandlerpublic final boolean hasGeneratedOutput()
getGeneratedOutput() will return a non-null
File if called).
hasGeneratedOutput in interface OutputHandlergetGeneratedOutput(),
getContentType()protected final java.io.File getOutputFile()
protected java.io.PrintWriter openOutputFile()
throws CurnException
CurnException - unable to open fileprotected final boolean savingOutputOnly()
protected final void setOutputEncoding(java.lang.String newEncoding)
CFG_ENCODING
configuration parameter. To have any effect, this method must be
called before openOutputFile()
newEncoding - the new encoding, or null to use the defaultgetOutputEncoding()protected final boolean displayToolInfo()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||