com.avian.util
Class BirdOutputFile

java.lang.Object
  extended by com.avian.util.BirdOutputFile

public class BirdOutputFile
extends java.lang.Object

A utility object that manages all of the messy details of opening and closing and output file that will hold the output from a bird. The assumption is that when processing is completed on an object, its results are written out to some kind of long term storage. If, for example, in a billing run, one customer's invoice has completed prepararation, it would be written to an output file so it could be sent to a printer. If you wanted to write to a database, however, you would need to extend this object so the open, write, and close methods perform the necessary interactions with the selected database manager.


Constructor Summary
BirdOutputFile(java.lang.String fileName)
          The only constructor that is defined for this helper object.
 
Method Summary
 void close()
          Closes the output file when the current bird does a stop or Return to Egg.
 java.lang.String getFileName()
          Returns the fileName that is currently set in this helper object.
 void open()
          Opens the fileName that was set when this object was created.
 void writeOutput(java.lang.String outputString)
          Writes the actual output to the file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BirdOutputFile

public BirdOutputFile(java.lang.String fileName)
The only constructor that is defined for this helper object. The assumption is that when you need to construct one object of this type, you will already know what the file name is.

Parameters:
fileName - String that contains the path and fileName to open and write to
Method Detail

getFileName

public java.lang.String getFileName()
Returns the fileName that is currently set in this helper object.

Returns:
String that contains the currently set fileName.

open

public void open()
Opens the fileName that was set when this object was created. The output file is opened so it will append to any existing file with this name.


writeOutput

public void writeOutput(java.lang.String outputString)
Writes the actual output to the file. The output file must already be opened. This method does not close the file when writing is complete. It also assumes that all formatting of the output String has already been performed and so it only sends the output to the file, exactly as it has received it, including \n.

Parameters:
outputString - String that will be written to the output file. This method does not format or modify the output String in any way.

close

public void close()
Closes the output file when the current bird does a stop or Return to Egg. This method should not be called between each write to the output file.