Sparksee
6.0.2
|
CSVReader interface. More...
Instance Methods | |
(id) | - init |
Constructs CSVReader. | |
(void) | - setSeparator: |
Sets the character used to separate fields in the file. More... | |
(void) | - setQuotes: |
Sets the character used to quote fields. More... | |
(void) | - setMultilines: |
Allows the use of fields with more than one line. More... | |
(void) | - setSingleLine |
Only allows single line fields. | |
(void) | - setStartLine: |
Sets the number of lines to be skiped from the beginning. More... | |
(void) | - setNumLines: |
Used to limit the number of lines that will be read. More... | |
(void) | - setLocale: |
Sets the locale that will be used to read the file. More... | |
(void) | - open: |
Opens the source file path. More... | |
(BOOL) | - reset |
Moves the reader to the beginning. More... | |
(BOOL) | - read: |
Reads the next row as a string array. More... | |
(int) | - getRow |
The row number for the current row. More... | |
(void) | - close |
Closes the reader. More... | |
CSVReader interface.
A very simple CSV reader.
It works as any other RowReader, but open must be called once before the first read operation.
Using the format RFC 4180.
Except: leading and trailing spaces, adjacent to CSV separator character, are trimmed.
You can use your own separators and quote characters. By default the separator is the comma (,) and the quote character is the double quotes (").
Fields with multiple lines can be allowed (and the maximum lines specified), but the default is a single line.
The locale string can be used to set the language, country and the file encoding. The format must be "[language_territory][.codeset]". But only the file encoding is being used in the current version.
The languages supported are: "en_US", "es_ES" and "ca_ES".
The file encodings supported are: "utf8" and "iso88591".
For example:
To don't change the default locales, use an empty string: "".
To read a file in utf8 with the default language settings use ".utf8".
To read a file in iso88591 with English language use: "en_US.iso88591".
Check out the 'Data import' section in the SPARKSEE User Manual for more details on this.
- (void) close |
- (int) getRow |
The row number for the current row.
System.IO.IOException | If it fails. |
Implements STSRowReader.
- (void) open: | (NSString *) | filePath |
Opens the source file path.
File can be optionally compressed in GZIP format.
filePath | [in] CSV file path. |
System.IO.IOException | If bad things happen opening the file. |
- (BOOL) read: | (STSStringList *) | row |
Reads the next row as a string array.
row | [out] A string list with each comma-separated element as a separate entry. |
System.IO.IOException | If bad things happen during the read. |
Implements STSRowReader.
- (BOOL) reset |
Moves the reader to the beginning.
Restarts the reader.
System.IO.IOException | If bad things happen during the restart. |
Implements STSRowReader.
- (void) setLocale: | (NSString *) | localeStr |
Sets the locale that will be used to read the file.
localeStr | [in] The locale string for the file encoding. |
- (void) setMultilines: | (int) | numExtralines |
Allows the use of fields with more than one line.
numExtralines | [in] Maximum number of extra lines for each column (0==unlimited, N==N+1 total rows). |
- (void) setNumLines: | (int) | numLines |
Used to limit the number of lines that will be read.
numLines | [in] The maximum number of lines to read (0 == unlimited) |
- (void) setQuotes: | (NSString *) | quotes |
Sets the character used to quote fields.
quotes | [in] Quote character. |
System.ApplicationException | null |
- (void) setSeparator: | (NSString *) | sep |
Sets the character used to separate fields in the file.
sep | [in] Separator character. |
System.ApplicationException | null |
- (void) setStartLine: | (int) | startLine |
Sets the number of lines to be skiped from the beginning.
startLine | [in] The line number to skip for start reading |