Interface FieldDelimiterSpecifier

  • All Superinterfaces:
    RecordSeparatorSpecifier
    All Known Implementing Classes:
    FieldDelimiterSettings

    public interface FieldDelimiterSpecifier
    extends RecordSeparatorSpecifier
    A collection of structural information about a text file consisting of delimited-field records. This includes information about identifying individual fields and whether a header row exists.

    Examples of such files are CSV and TSV files.

    • Method Detail

      • set

        void set​(FieldDelimiterSpecifier source)
        Copies the settings from the given structure specifier.
        Parameters:
        source - field data specifier containing the desired settings
      • getFieldSeparator

        String getFieldSeparator()
        Returns the delimiter used to distinguish field boundaries.
        Returns:
        the string used to separate fields
      • setFieldSeparator

        void setFieldSeparator​(String separator)
        Sets the delimiter used to define the boundary between data fields.
        Parameters:
        separator - string used to separate fields
        Throws:
        InvalidPropertyValueException - if the delimiter is null or the empty string
      • getAutoDiscoverSeparator

        boolean getAutoDiscoverSeparator()
        Indicates whether automated field separator discovery is configured.
        Returns:
        true if field separator discovery is enabled, false otherwise.
      • setAutoDiscoverSeparator

        void setAutoDiscoverSeparator​(boolean enabled)
        Sets whether automated field separator discovery is configured. When set, the source file should be analyzed to determine the most likely candidate for the field separator. The decision is based on the consistency on the number of fields produces across all sampled records.

        Only a small set of common separators are considered when attempting to discover the field separator. Those considered are: comma (','), semi-colon (';'), tab ('\t'), pipe ('|'), and space (' ').

        This option is enabled by default. If a field separator is explicitly specified, separator discovery is disabled.

        Parameters:
        enabled - indicates whether to discover the field separator character.
        See Also:
        setFieldSeparator(String)
      • getFieldEndDelimiter

        String getFieldEndDelimiter()
        Returns the end of field delimiter.
        Returns:
        the string used to mark the end of a field value
      • getFieldStartDelimiter

        String getFieldStartDelimiter()
        Returns the start of field delimiter.
        Returns:
        the string used to mark the beginning of a field value
      • setFieldDelimiter

        void setFieldDelimiter​(String delimiter)
        Sets the delimiter used to denote the boundaries of a data field.

        This method is generally equivalent to calling setFieldStartDelimiter() and setFieldEndDelimiter() with the same parameter values. However, those methods do not allow the empty string as a parameter.

        Parameters:
        delimiter - string used to optionally mark the start and end of a field value. An empty string indicates field values are not delimited.
        Throws:
        InvalidPropertyValueException - if the delimiter is null
      • setFieldStartDelimiter

        void setFieldStartDelimiter​(String delimiter)
        Sets the delimiter used to denote the beginning of a data field. It not permitted to set the start delimiter to the empty string; use setFieldDelimiter(String) instead to indicate no delimiters.
        Parameters:
        delimiter - string used to mark the start of a field value
        Throws:
        InvalidPropertyValueException - if the delimiter is null or the empty string
      • setFieldEndDelimiter

        void setFieldEndDelimiter​(String delimiter)
        Sets the delimiter used to denote the end of a data field. It not permitted to set the end delimiter to the empty string; use setFieldDelimiter(String) instead to indicate no delimiters.
        Parameters:
        delimiter - string used to mark the start of a field value
        Throws:
        InvalidPropertyValueException - if the delimiter is null or the empty string
      • getAutoDiscoverDelimiter

        boolean getAutoDiscoverDelimiter()
        Indicates whether automated field delimiter discovery is configured.
        Returns:
        true if field separator discovery is enabled, false otherwise.
      • setAutoDiscoverDelimiter

        void setAutoDiscoverDelimiter​(boolean enabled)
        Sets whether automated field delimiter discovery is configured. When set, the source file should be analyzed to determine the most likely candidate for the field delimiter. The decision is based on whether candidates produce consistent parsing behavior on the sample.

        Only double quote (") and single quote (') are considered as possible delimiters. To be chosen, the delimiter must appear in the sample. If neither is appropriate (or if both seem appropriate) for the sample, the text is assumed to be undelimited.

        This option is enabled by default. If a field delimiter is explicitly specified, delimiter discovery is disabled.

        Parameters:
        enabled - indicates whether to discover the field delimiter character.
        See Also:
        setFieldDelimiter(String)