Class TableExporter

  • All Implemented Interfaces:
    Exporter<java.lang.Object>

    public class TableExporter
    extends ObjectExporter
    implements Exporter<java.lang.Object>
    Defines methods for converting a table object to a desired export type.
    • Method Detail

      • convert

        public void convert​(java.lang.Object object,
                            java.io.OutputStream outputStream)
                     throws java.io.IOException,
                            InvalidTableException,
                            com.opencsv.exceptions.CsvValidationException
        Converts the table object into the desired export type. The valid table objects are TableCharacter, TableBinary and TableDelimited.
        Specified by:
        convert in interface Exporter<java.lang.Object>
        Parameters:
        object - the table object to convert
        outputStream - the output stream for the output file
        Throws:
        java.io.IOException - If an I/O error occurs
        com.opencsv.exceptions.CsvValidationException
        MissingDataException
        InvalidTableException
      • convert

        public void convert​(java.io.OutputStream outputStream,
                            int objectIndex)
                     throws java.io.IOException,
                            InvalidTableException,
                            com.opencsv.exceptions.CsvValidationException
        Converts the table object at the given objectIndex into the desired export type.
        Specified by:
        convert in interface Exporter<java.lang.Object>
        Parameters:
        outputStream - the output stream for the output file
        objectIndex - the index of the input table object
        Throws:
        java.io.IOException - If an I/O error occurs
        com.opencsv.exceptions.CsvValidationException
        MissingDataException
        InvalidTableException
      • getExportType

        public java.lang.String getExportType()
        Gets the desired export type.
        Returns:
        the export type
      • setExportType

        public void setExportType​(java.lang.String exportType)
        Sets the desired export (output) type. Currently, "CSV" is the only supported type.
        Specified by:
        setExportType in interface Exporter<java.lang.Object>
        Parameters:
        exportType - the export type
      • setDecoder

        public void setDecoder​(java.lang.String charsetName)
        Sets a character set to use for decoding the bytes.
        Parameters:
        charsetName - the name of a character set
        Throws:
        java.nio.charset.UnsupportedCharsetException - If name is not valid
      • getDecoder

        public java.nio.charset.Charset getDecoder()
        Returns the Charset to use for decoding the bytes.
        Returns:
        a character set
      • setEncoder

        public void setEncoder​(java.lang.String charsetName)
        Sets a character set to use for encoding the bytes.
        Parameters:
        charsetName - the name of a character set
        Throws:
        java.nio.charset.UnsupportedCharsetException - If name is not valid
      • getEncoder

        public java.nio.charset.Charset getEncoder()
        Returns the Charset to use for encoding the bytes.
        Returns:
        a character set