Class FieldDelimiterSettings
- java.lang.Object
-
- com.pervasive.datarush.operators.io.textfile.RecordSeparatorSettings
-
- com.pervasive.datarush.operators.io.textfile.FieldDelimiterSettings
-
- All Implemented Interfaces:
FieldDelimiterSpecifier,RecordSeparatorSpecifier
public class FieldDelimiterSettings extends RecordSeparatorSettings implements FieldDelimiterSpecifier
A container for structural information about a text file containing delimited records. The default settings are:- Records are separated by "newlines", where this may be either Windows-style (CRLF) or Unix-style (LF). On read, the style will automatically be detected. On write, the system appropriate style will be used.
- Fields are separated by commas (the ',' character).
- Field values are optionally delimited with double quotes (the '"' character).
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_FIELD_DELIMITERThe default field delimiterstatic StringDEFAULT_FIELD_SEPARATORThe default field separator-
Fields inherited from class com.pervasive.datarush.operators.io.textfile.RecordSeparatorSettings
SYSTEM_NEWLINE
-
-
Constructor Summary
Constructors Constructor Description FieldDelimiterSettings()Creates a new container with default settings.FieldDelimiterSettings(FieldDelimiterSpecifier source)Creates a container initialized using the given structural information.FieldDelimiterSettings(String separator)Creates a new container with using the specified field separator and the default field delimiter.FieldDelimiterSettings(String separator, String delimiter)Creates a new container with using the specified field separator and field delimiter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleangetAutoDiscoverDelimiter()Indicates whether automated field delimiter discovery is configured.booleangetAutoDiscoverSeparator()Indicates whether automated field separator discovery is configured.StringgetFieldEndDelimiter()Returns the end of field delimiter.StringgetFieldSeparator()Returns the delimiter used to distinguish field boundaries.StringgetFieldStartDelimiter()Returns the start of field delimiter.voidset(FieldDelimiterSpecifier source)Copies the settings from the given structure specifier.voidsetAutoDiscoverDelimiter(boolean enabled)Sets whether automated field delimiter discovery is configured.voidsetAutoDiscoverSeparator(boolean enabled)Sets whether automated field separator discovery is configured.voidsetFieldDelimiter(String delimiter)Sets the delimiter used to denote the boundaries of a data field.voidsetFieldEndDelimiter(String endDelimiter)Sets the delimiter used to denote the end of a data field.voidsetFieldSeparator(String separator)Sets the delimiter used to define the boundary between data fields.voidsetFieldStartDelimiter(String startDelimiter)Sets the delimiter used to denote the beginning of a data field.StringtoString()-
Methods inherited from class com.pervasive.datarush.operators.io.textfile.RecordSeparatorSettings
getAutoDiscoverNewline, getRecordSeparator, set, setAutoDiscoverNewline, setRecordSeparator
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.pervasive.datarush.operators.io.textfile.RecordSeparatorSpecifier
getAutoDiscoverNewline, getRecordSeparator, set, setAutoDiscoverNewline, setRecordSeparator
-
-
-
-
Field Detail
-
DEFAULT_FIELD_DELIMITER
public static final String DEFAULT_FIELD_DELIMITER
The default field delimiter- See Also:
- Constant Field Values
-
DEFAULT_FIELD_SEPARATOR
public static final String DEFAULT_FIELD_SEPARATOR
The default field separator- See Also:
- Constant Field Values
-
-
Constructor Detail
-
FieldDelimiterSettings
public FieldDelimiterSettings()
Creates a new container with default settings.
-
FieldDelimiterSettings
public FieldDelimiterSettings(String separator)
Creates a new container with using the specified field separator and the default field delimiter.- Parameters:
separator- string used to separate fields- Throws:
InvalidPropertyValueException- if the separator isnullor the empty string
-
FieldDelimiterSettings
public FieldDelimiterSettings(String separator, String delimiter)
Creates a new container with using the specified field separator and field delimiter.- Parameters:
separator- string used to separate fieldsdelimiter- string used to mark the start and end of a field value An empty string indicates field values are not delimited.- Throws:
InvalidPropertyValueException- if the delimiter isnullor the separator isnullor empty
-
FieldDelimiterSettings
public FieldDelimiterSettings(FieldDelimiterSpecifier source)
Creates a container initialized using the given structural information.- Parameters:
source- field specifier data from which to initialize the settings
-
-
Method Detail
-
set
public void set(FieldDelimiterSpecifier source)
Description copied from interface:FieldDelimiterSpecifierCopies the settings from the given structure specifier.- Specified by:
setin interfaceFieldDelimiterSpecifier- Parameters:
source- field data specifier containing the desired settings
-
getFieldSeparator
public String getFieldSeparator()
Description copied from interface:FieldDelimiterSpecifierReturns the delimiter used to distinguish field boundaries.- Specified by:
getFieldSeparatorin interfaceFieldDelimiterSpecifier- Returns:
- the string used to separate fields
-
setFieldSeparator
public void setFieldSeparator(String separator)
Description copied from interface:FieldDelimiterSpecifierSets the delimiter used to define the boundary between data fields.- Specified by:
setFieldSeparatorin interfaceFieldDelimiterSpecifier- Parameters:
separator- string used to separate fields
-
getAutoDiscoverSeparator
public boolean getAutoDiscoverSeparator()
Description copied from interface:FieldDelimiterSpecifierIndicates whether automated field separator discovery is configured.- Specified by:
getAutoDiscoverSeparatorin interfaceFieldDelimiterSpecifier- Returns:
trueif field separator discovery is enabled,falseotherwise.
-
setAutoDiscoverSeparator
public void setAutoDiscoverSeparator(boolean enabled)
Description copied from interface:FieldDelimiterSpecifierSets 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.
- Specified by:
setAutoDiscoverSeparatorin interfaceFieldDelimiterSpecifier- Parameters:
enabled- indicates whether to discover the field separator character.- See Also:
FieldDelimiterSpecifier.setFieldSeparator(String)
-
setFieldDelimiter
public void setFieldDelimiter(String delimiter)
Description copied from interface:FieldDelimiterSpecifierSets the delimiter used to denote the boundaries of a data field.This method is generally equivalent to calling
setFieldStartDelimiter()andsetFieldEndDelimiter()with the same parameter values. However, those methods do not allow the empty string as a parameter.- Specified by:
setFieldDelimiterin interfaceFieldDelimiterSpecifier- Parameters:
delimiter- string used to optionally mark the start and end of a field value. An empty string indicates field values are not delimited.
-
getFieldStartDelimiter
public String getFieldStartDelimiter()
Description copied from interface:FieldDelimiterSpecifierReturns the start of field delimiter.- Specified by:
getFieldStartDelimiterin interfaceFieldDelimiterSpecifier- Returns:
- the string used to mark the beginning of a field value
-
getFieldEndDelimiter
public String getFieldEndDelimiter()
Description copied from interface:FieldDelimiterSpecifierReturns the end of field delimiter.- Specified by:
getFieldEndDelimiterin interfaceFieldDelimiterSpecifier- Returns:
- the string used to mark the end of a field value
-
setFieldStartDelimiter
public void setFieldStartDelimiter(String startDelimiter)
Description copied from interface:FieldDelimiterSpecifierSets the delimiter used to denote the beginning of a data field. It not permitted to set the start delimiter to the empty string; useFieldDelimiterSpecifier.setFieldDelimiter(String)instead to indicate no delimiters.- Specified by:
setFieldStartDelimiterin interfaceFieldDelimiterSpecifier- Parameters:
startDelimiter- string used to mark the start of a field value
-
setFieldEndDelimiter
public void setFieldEndDelimiter(String endDelimiter)
Description copied from interface:FieldDelimiterSpecifierSets the delimiter used to denote the end of a data field. It not permitted to set the end delimiter to the empty string; useFieldDelimiterSpecifier.setFieldDelimiter(String)instead to indicate no delimiters.- Specified by:
setFieldEndDelimiterin interfaceFieldDelimiterSpecifier- Parameters:
endDelimiter- string used to mark the start of a field value
-
getAutoDiscoverDelimiter
public boolean getAutoDiscoverDelimiter()
Description copied from interface:FieldDelimiterSpecifierIndicates whether automated field delimiter discovery is configured.- Specified by:
getAutoDiscoverDelimiterin interfaceFieldDelimiterSpecifier- Returns:
trueif field separator discovery is enabled,falseotherwise.
-
setAutoDiscoverDelimiter
public void setAutoDiscoverDelimiter(boolean enabled)
Description copied from interface:FieldDelimiterSpecifierSets 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.
- Specified by:
setAutoDiscoverDelimiterin interfaceFieldDelimiterSpecifier- Parameters:
enabled- indicates whether to discover the field delimiter character.- See Also:
FieldDelimiterSpecifier.setFieldDelimiter(String)
-
toString
public String toString()
- Overrides:
toStringin classRecordSeparatorSettings
-
-