com.amazonaws.mturk.addon
Class HITDataCSVWriter

java.lang.Object
  extended by com.amazonaws.mturk.addon.AbstractHITDataOutput
      extended by com.amazonaws.mturk.addon.HITDataCSVWriter
All Implemented Interfaces:
HITDataOutput

public class HITDataCSVWriter
extends AbstractHITDataOutput


Field Summary
protected  CSVWriter csvWriter
           
 
Constructor Summary
HITDataCSVWriter(java.lang.String fileName)
          Creates a new tab-delimited, appending CSV writer
HITDataCSVWriter(java.lang.String fileName, char separator, boolean appendToFile)
          Creates a new CSV writer
HITDataCSVWriter(java.lang.String fileName, char separator, boolean appendToFile, boolean useQuotes)
          Creates a new CSV writer
 
Method Summary
 void close()
          Closes the underlying writer.
protected  CSVWriter getWriter()
           
 void setFieldNames(java.lang.String[] fieldNames)
           
 void writeLine(java.lang.String[] fieldValues)
           
 void writeValues(java.util.Map<java.lang.String,java.lang.String> values)
           
 
Methods inherited from class com.amazonaws.mturk.addon.AbstractHITDataOutput
addFieldName, getFieldNames, getFieldNamesSize, getValuesByFieldName, getValuesByFieldName, setFieldNames
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

csvWriter

protected CSVWriter csvWriter
Constructor Detail

HITDataCSVWriter

public HITDataCSVWriter(java.lang.String fileName)
Creates a new tab-delimited, appending CSV writer

Parameters:
fileName - Name of file to write to

HITDataCSVWriter

public HITDataCSVWriter(java.lang.String fileName,
                        char separator,
                        boolean appendToFile,
                        boolean useQuotes)
Creates a new CSV writer

Parameters:
fileName - Name of file to write to
separator - Separator character to use
appendToFile - If true, append to existing file or create new file
useQuotes - If true, wraps values in quotes

HITDataCSVWriter

public HITDataCSVWriter(java.lang.String fileName,
                        char separator,
                        boolean appendToFile)
Creates a new CSV writer

Parameters:
fileName - Name of file to write to
separator - Separator character to use
appendToFile - If true, append to existing file or create new file
Method Detail

close

public void close()
Closes the underlying writer.

Specified by:
close in interface HITDataOutput
Overrides:
close in class AbstractHITDataOutput
Throws:
java.lang.IllegalStateException - if the close fails.

getWriter

protected CSVWriter getWriter()
                       throws java.io.IOException
Throws:
java.io.IOException

setFieldNames

public void setFieldNames(java.lang.String[] fieldNames)
Specified by:
setFieldNames in interface HITDataOutput
Overrides:
setFieldNames in class AbstractHITDataOutput

writeLine

public void writeLine(java.lang.String[] fieldValues)
               throws java.io.IOException
Throws:
java.io.IOException

writeValues

public void writeValues(java.util.Map<java.lang.String,java.lang.String> values)
                 throws java.io.IOException
Throws:
java.io.IOException