Class CsvWriter

java.lang.Object
nz.org.riskscape.engine.output.RiskscapeWriter
nz.org.riskscape.engine.output.CsvWriter
All Implemented Interfaces:
Closeable, AutoCloseable

public class CsvWriter extends nz.org.riskscape.engine.output.RiskscapeWriter implements AutoCloseable

Very simple csv writer, to avoid the ceremony and geometry-required-ness of the geotools one. Quotes values with double quotes if they contain a double quote, a comma or a return character.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Per column character limit beyond which column content will be truncated.
  • Constructor Summary

    Constructors
    Constructor
    Description
    CsvWriter(nz.org.riskscape.problem.ProblemSink problemSink, File file)
     
    CsvWriter(nz.org.riskscape.problem.ProblemSink problemSink, nz.org.riskscape.engine.resource.CreateHandle handle)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
     
    void
    write(@NonNull nz.org.riskscape.engine.Tuple value)
     
    protected boolean
    write(nz.org.riskscape.engine.types.Struct struct, nz.org.riskscape.engine.Tuple value, boolean first)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • COLUMN_MAX_CHARACTERS

      public static final int COLUMN_MAX_CHARACTERS

      Per column character limit beyond which column content will be truncated. This is because Excel has a limit of 32,767 characters and will not display a file that contains columns that exceed that limit.

      Ideally this would be configurable, but we have no facility for passing options to output formats (GL#420)

      See Also:
  • Constructor Details

    • CsvWriter

      public CsvWriter(nz.org.riskscape.problem.ProblemSink problemSink, nz.org.riskscape.engine.resource.CreateHandle handle)
    • CsvWriter

      public CsvWriter(nz.org.riskscape.problem.ProblemSink problemSink, File file) throws FileNotFoundException
      Throws:
      FileNotFoundException
  • Method Details

    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException
    • write

      public void write(@NonNull @NonNull nz.org.riskscape.engine.Tuple value)
      Specified by:
      write in class nz.org.riskscape.engine.output.RiskscapeWriter
    • write

      protected boolean write(nz.org.riskscape.engine.types.Struct struct, nz.org.riskscape.engine.Tuple value, boolean first) throws IOException
      Throws:
      IOException
    • getStoredAt

      public URI getStoredAt()
      Specified by:
      getStoredAt in class nz.org.riskscape.engine.output.RiskscapeWriter