public class DelimitedTextAnalyzer extends Object
','
), tab ('\t'
), semicolon (';'
),
pipe ('|'
), and space (' '
).'
) or double quote ("
).
If one cannot be determined, the text is assumed to be undelimited.#
), %
, and //
.
If one cannot be determined, it is assumed there is no comment marker.Modifier and Type | Class and Description |
---|---|
static class |
DelimitedTextAnalyzer.Analysis
Contains the results of an analysis of a delimited text file.
|
Constructor and Description |
---|
DelimitedTextAnalyzer(FieldDelimiterSpecifier delimiters)
Creates a new analyzer which uses the given delimiter information.
|
Modifier and Type | Method and Description |
---|---|
DelimitedTextAnalyzer.Analysis |
analyze(Path file,
CharsetEncoding charsetSpec)
Analyzes the specified file based on current configuration.
|
DelimitedTextAnalyzer.Analysis |
analyze(Path file,
CharsetEncoding charsetSpec,
FileClient client)
Analyzes the specified file based on current configuration.
|
DelimitedTextAnalyzer.Analysis |
analyze(Reader input)
Analyzes the specified text stream based on current configuration.
|
DelimitedTextAnalyzer.Analysis |
analyze(String file,
CharsetEncoding charsetSpec)
Analyzes the specified file based on current configuration.
|
void |
setAnalysisSize(int count)
Sets the maximum number of characters to use in analysis.
|
void |
setHeaderSkipCount(int count)
Sets the number of lines to skip at the beginning of the file.
|
void |
setLineComment(String lineComment)
Set the value of the indicator that a line is commented and should
be ignored.
|
public DelimitedTextAnalyzer(FieldDelimiterSpecifier delimiters)
delimiters
- field structure information from which to initialize settingspublic void setAnalysisSize(int count)
count
- the number of characters to analyzepublic void setLineComment(String lineComment)
lineComment
- the string value indicating a line is commented outpublic void setHeaderSkipCount(int count)
count
- the number lines at the start of the file to skippublic DelimitedTextAnalyzer.Analysis analyze(String file, CharsetEncoding charsetSpec) throws IOException
file
- path to the delimited text file to analyzecharsetSpec
- description of the file's character set encodingIOException
- if an error occurs while reading the fileRowTooLongException
- if the first row exceeds the configured
lengthpublic DelimitedTextAnalyzer.Analysis analyze(Path file, CharsetEncoding charsetSpec) throws IOException
file
- path to the delimited text file to analyzecharsetSpec
- description of the file's character set encodingIOException
- if an error occurs while reading the fileRowTooLongException
- if the first row exceeds the configured
lengthpublic DelimitedTextAnalyzer.Analysis analyze(Path file, CharsetEncoding charsetSpec, FileClient client) throws IOException
file
- path to the delimited text file to analyzecharsetSpec
- description of the file's character set encodingclient
- the authorization context to use for accessing the fileIOException
- if an error occurs while reading the fileRowTooLongException
- if the first row exceeds the configured
lengthpublic DelimitedTextAnalyzer.Analysis analyze(Reader input) throws IOException, RowTooLongException
input
- the text data to analyzeIOException
- if an error occurs while reading the fileRowTooLongException
- if the first row exceeds the configured
lengthCopyright © 2016 Actian Corporation. All rights reserved.