Class Reader

    • Field Detail

      • m_RowClass

        protected Class m_RowClass
        the row class to use.
      • m_Finished

        protected boolean m_Finished
        indicates whether the reading has finished.
      • m_Stopped

        protected boolean m_Stopped
        whether the reading was stopped.
      • m_Type

        protected int[] m_Type
        the column types.
    • Constructor Detail

      • Reader

        public Reader​(AbstractTypeMapper typeMapper,
                      Class rowClass)
        Initializes the reader.
        Parameters:
        rowClass - the class for the rows in the spreadsheet, e.g. DenseDataRow
        typeMapper - the type mapper to use
    • Method Detail

      • setLoggingLevel

        public void setLoggingLevel​(LoggingLevel value)
        Sets the logging level.
        Parameters:
        value - the level
      • initHeader

        public void initHeader​(ResultSet rs)
                        throws SQLException
        Initializes the header
        Parameters:
        rs - the resultset to use as basis
        Throws:
        SQLException - if accessing of meta-data fails
      • getRowClass

        public Class getRowClass()
        Returns the row class in use.
        Returns:
        the class
      • getTypeMapper

        public AbstractTypeMapper getTypeMapper()
        Returns the type mapper in use.
        Returns:
        the type mapper
      • read

        public SpreadSheet read​(ResultSet rs)
                         throws SQLException
        Reads all the data from the provided result set.
        Parameters:
        rs - the result set to turn into a spreadsheet
        Returns:
        the generated spreadsheet
        Throws:
        SQLException - if reading fails
      • read

        public SpreadSheet read​(ResultSet rs,
                                int max)
                         throws SQLException
        Reads the data from the provided result set, up to the specified maximum of rows. Automatically closes the result set if all data has been read.
        Parameters:
        rs - the result set to turn into a spreadsheet
        max - the maximum number of rows to read, 0 or less means all
        Returns:
        the generated spreadsheet
        Throws:
        SQLException - if reading fails
      • stopExecution

        public void stopExecution()
        Stops the execution.
        Specified by:
        stopExecution in interface Stoppable
      • isStopped

        public boolean isStopped()
        Returns whether the reader has been stopped.
        Returns:
        true if stopped
      • isFinished

        public boolean isFinished()
        Returns whether the reader has finished reading data.
        Returns:
        true if finished