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 Summary
All Methods Instance Methods Abstract 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 delimiter)
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 delimiter)
Sets the delimiter used to denote the beginning of a data field.-
Methods inherited from interface com.pervasive.datarush.operators.io.textfile.RecordSeparatorSpecifier
getAutoDiscoverNewline, getRecordSeparator, set, setAutoDiscoverNewline, setRecordSeparator
-
-
-
-
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 isnull
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()
andsetFieldEndDelimiter()
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 isnull
-
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; usesetFieldDelimiter(String)
instead to indicate no delimiters.- Parameters:
delimiter
- string used to mark the start of a field value- Throws:
InvalidPropertyValueException
- if the delimiter isnull
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; usesetFieldDelimiter(String)
instead to indicate no delimiters.- Parameters:
delimiter
- string used to mark the start of a field value- Throws:
InvalidPropertyValueException
- if the delimiter isnull
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)
-
-