Skip navigation links
net.sf.jasperreports.engine.data

Class JRCsvDataSource

    • Field Detail

      • log

        protected static final org.apache.commons.logging.Log log
      • EXCEPTION_MESSAGE_KEY_CSV_FIELD_VALUE_NOT_RETRIEVED

        public static final String EXCEPTION_MESSAGE_KEY_CSV_FIELD_VALUE_NOT_RETRIEVED
        See Also:
        Constant Field Values
      • EXCEPTION_MESSAGE_KEY_MALFORMED_QUOTED_FIELD

        public static final String EXCEPTION_MESSAGE_KEY_MALFORMED_QUOTED_FIELD
        See Also:
        Constant Field Values
      • EXCEPTION_MESSAGE_KEY_MISPLACED_QUOTE

        public static final String EXCEPTION_MESSAGE_KEY_MISPLACED_QUOTE
        See Also:
        Constant Field Values
      • PROPERTY_FIELD_COLUMN_NAME

        public static final String PROPERTY_FIELD_COLUMN_NAME
        Property specifying the CSV column name for the dataset field.
        See Also:
        Constant Field Values
      • PROPERTY_FIELD_COLUMN_INDEX

        public static final String PROPERTY_FIELD_COLUMN_INDEX
        Property specifying the CSV column index for the dataset field.
        See Also:
        Constant Field Values
    • Method Detail

      • next

        public boolean next()
                     throws JRException
        Description copied from interface: JRDataSource
        Tries to position the cursor on the next element in the data source.
        Returns:
        true if there is a next record, false otherwise
        Throws:
        JRException - if any error occurs while trying to move to the next element
      • assignColumnNames

        protected void assignColumnNames()
      • getFieldValue

        public Object getFieldValue(JRField jrField)
                             throws JRException
        Description copied from interface: JRDataSource
        Gets the field value for the current position.
        Returns:
        an object containing the field value. The object type must be the field object type.
        Throws:
        JRException
      • getDateFormat

        public DateFormat getDateFormat()
        Gets the date format that will be used to parse date fields
      • setDateFormat

        public void setDateFormat(DateFormat dateFormat)
        Sets the desired date format to be used for parsing date fields
      • getFieldDelimiter

        public char getFieldDelimiter()
        Returns the field delimiter character.
      • setFieldDelimiter

        public void setFieldDelimiter(char fieldDelimiter)
        Sets the field delimiter character. The default is comma. If characters such as comma or quotes are specified, the results can be unpredictable.
        Parameters:
        fieldDelimiter -
      • getRecordDelimiter

        public String getRecordDelimiter()
        Returns the record delimiter string.
      • setRecordDelimiter

        public void setRecordDelimiter(String recordDelimiter)
        Sets the record delimiter string. The default is line feed (\n).
        Parameters:
        recordDelimiter -
      • setColumnNames

        public void setColumnNames(String[] columnNames)
        Specifies an array of strings representing column names matching field names in the report template
      • setUseFirstRowAsHeader

        public void setUseFirstRowAsHeader(boolean useFirstRowAsHeader)
        Specifies whether the first line of the CSV file should be considered a table header, containing column names matching field names in the report template
      • close

        public void close()
        Closes the reader. Users of this data source should close it after usage.
      • setNumberFormat

        public void setNumberFormat(NumberFormat numberFormat)

Copyright © 2020 TIBCO Software Inc.. All rights reserved.