uchicago.src.sim.analysis
Class DataFileWriter

java.lang.Object
  extended by uchicago.src.sim.analysis.DataFileWriter
All Implemented Interfaces:
BlockFileWriter

public class DataFileWriter
extends java.lang.Object
implements BlockFileWriter

Writes objects to a file via their toString() method. DataFileWriter is used by recording objects to write data to a file.

Version:
$Revision: 1.6 $ $Date: 2004/11/15 17:22:34 $
Author:
Nick Collier

Constructor Summary
DataFileWriter(java.lang.String fileName, DataFileHeader dfHeader)
          Constructs a DataFileWriter to write to the specified file using the specified DataFileHeader.
 
Method Summary
 void setBlockHeader(java.lang.String blockHeader)
          Sets a block header.
 void writeToFile(java.lang.Object obj)
          Writes the specifed object out to a file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataFileWriter

public DataFileWriter(java.lang.String fileName,
                      DataFileHeader dfHeader)
Constructs a DataFileWriter to write to the specified file using the specified DataFileHeader.

Parameters:
filename - the name of the file to write the data out to.
dfHeader - the DataFileHeader for this file.
Method Detail

setBlockHeader

public void setBlockHeader(java.lang.String blockHeader)
Sets a block header. Once this has been called the next call to writeToFile will write the block header to the file. The block header will be the header for any data then written out to the file via writeToFile(). Subsequent calls to setBlockHeader will again force the new block header to be written.
If the block header is either null or "" this will disable the writing of the block header

Specified by:
setBlockHeader in interface BlockFileWriter
Parameters:
blockHeader - the header for a block of data

writeToFile

public void writeToFile(java.lang.Object obj)
Writes the specifed object out to a file. The String representation of the object (via Object.toString()) is written.

Specified by:
writeToFile in interface BlockFileWriter
Parameters:
obj - the object whose String representation will be written to a file.