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 String
DEFAULT_FIELD_DELIMITER
The default field delimiterstatic String
DEFAULT_FIELD_SEPARATOR
The 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 boolean
getAutoDiscoverDelimiter()
Indicates whether automated field delimiter discovery is configured.boolean
getAutoDiscoverSeparator()
Indicates whether automated field separator discovery is configured.String
getFieldEndDelimiter()
Returns the end of field delimiter.String
getFieldSeparator()
Returns the delimiter used to distinguish field boundaries.String
getFieldStartDelimiter()
Returns the start of field delimiter.void
set(FieldDelimiterSpecifier source)
Copies the settings from the given structure specifier.void
setAutoDiscoverDelimiter(boolean enabled)
Sets whether automated field delimiter discovery is configured.void
setAutoDiscoverSeparator(boolean enabled)
Sets whether automated field separator discovery is configured.void
setFieldDelimiter(String delimiter)
Sets the delimiter used to denote the boundaries of a data field.void
setFieldEndDelimiter(String endDelimiter)
Sets the delimiter used to denote the end of a data field.void
setFieldSeparator(String separator)
Sets the delimiter used to define the boundary between data fields.void
setFieldStartDelimiter(String startDelimiter)
Sets the delimiter used to denote the beginning of a data field.String
toString()
-
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 isnull
or 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 isnull
or the separator isnull
or 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:FieldDelimiterSpecifier
Copies the settings from the given structure specifier.- Specified by:
set
in interfaceFieldDelimiterSpecifier
- Parameters:
source
- field data specifier containing the desired settings
-
getFieldSeparator
public String getFieldSeparator()
Description copied from interface:FieldDelimiterSpecifier
Returns the delimiter used to distinguish field boundaries.- Specified by:
getFieldSeparator
in interfaceFieldDelimiterSpecifier
- Returns:
- the string used to separate fields
-
setFieldSeparator
public void setFieldSeparator(String separator)
Description copied from interface:FieldDelimiterSpecifier
Sets the delimiter used to define the boundary between data fields.- Specified by:
setFieldSeparator
in interfaceFieldDelimiterSpecifier
- Parameters:
separator
- string used to separate fields
-
getAutoDiscoverSeparator
public boolean getAutoDiscoverSeparator()
Description copied from interface:FieldDelimiterSpecifier
Indicates whether automated field separator discovery is configured.- Specified by:
getAutoDiscoverSeparator
in interfaceFieldDelimiterSpecifier
- Returns:
true
if field separator discovery is enabled,false
otherwise.
-
setAutoDiscoverSeparator
public void setAutoDiscoverSeparator(boolean enabled)
Description copied from interface:FieldDelimiterSpecifier
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.
- Specified by:
setAutoDiscoverSeparator
in 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:FieldDelimiterSpecifier
Sets 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:
setFieldDelimiter
in 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:FieldDelimiterSpecifier
Returns the start of field delimiter.- Specified by:
getFieldStartDelimiter
in interfaceFieldDelimiterSpecifier
- Returns:
- the string used to mark the beginning of a field value
-
getFieldEndDelimiter
public String getFieldEndDelimiter()
Description copied from interface:FieldDelimiterSpecifier
Returns the end of field delimiter.- Specified by:
getFieldEndDelimiter
in interfaceFieldDelimiterSpecifier
- Returns:
- the string used to mark the end of a field value
-
setFieldStartDelimiter
public void setFieldStartDelimiter(String startDelimiter)
Description copied from interface:FieldDelimiterSpecifier
Sets 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:
setFieldStartDelimiter
in interfaceFieldDelimiterSpecifier
- Parameters:
startDelimiter
- string used to mark the start of a field value
-
setFieldEndDelimiter
public void setFieldEndDelimiter(String endDelimiter)
Description copied from interface:FieldDelimiterSpecifier
Sets 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:
setFieldEndDelimiter
in interfaceFieldDelimiterSpecifier
- Parameters:
endDelimiter
- string used to mark the start of a field value
-
getAutoDiscoverDelimiter
public boolean getAutoDiscoverDelimiter()
Description copied from interface:FieldDelimiterSpecifier
Indicates whether automated field delimiter discovery is configured.- Specified by:
getAutoDiscoverDelimiter
in interfaceFieldDelimiterSpecifier
- Returns:
true
if field separator discovery is enabled,false
otherwise.
-
setAutoDiscoverDelimiter
public void setAutoDiscoverDelimiter(boolean enabled)
Description copied from interface:FieldDelimiterSpecifier
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.
- Specified by:
setAutoDiscoverDelimiter
in interfaceFieldDelimiterSpecifier
- Parameters:
enabled
- indicates whether to discover the field delimiter character.- See Also:
FieldDelimiterSpecifier.setFieldDelimiter(String)
-
toString
public String toString()
- Overrides:
toString
in classRecordSeparatorSettings
-
-