RePast
v. 2.0

uchicago.src.sim.analysis
Class DataFileWriter

java.lang.Object
  |
  +--uchicago.src.sim.analysis.DataFileWriter
All Implemented Interfaces:
BlockFileWriter

public class DataFileWriter
extends Object
implements BlockFileWriter

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


Constructor Summary
DataFileWriter(String fileName, DataFileHeader dfHeader)
          Constructs a DataFileWriter to write to the specified file using the specified DataFileHeader.
 
Method Summary
 void setBlockHeader(String blockHeader)
          Sets a block header.
 void writeToFile(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(String fileName,
                      DataFileHeader dfHeader)
Constructs a DataFileWriter to write to the specified file using the specified DataFileHeader.

Parameters:
dfHeader - the DataFileHeader for this file.
Method Detail

setBlockHeader

public void setBlockHeader(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.

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

writeToFile

public void writeToFile(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.

RePast
v. 2.0

Bug reports and feature requests to RePast