| Modifier and Type | Field and Description |
|---|---|
| protected final char | |
| protected final char | |
| protected final char |
| Access | Constructor and Description |
|---|---|
| public | |
| public | CSVWriter(Writer
The writer to an underlying CSV source. writer, char The delimiter to use for separating entries separator, char The character to use for quoted elements quotechar, char The character to use for escaping quotechars or escapechars escapechar, String The line feed terminator to use lineEnd)Constructs CSVWriter with supplied separator, quote char, escape char and line ending. |
| Modifier and Type | Method and Description |
|---|---|
| private void | appendQuoteCharacterIfNeeded(boolean applyQuotesToAll, Appendable appendable, Boolean stringContainsSpecialCharacters)
|
| protected boolean | Returns: Whether the character needs to be quoted or notThe next character to be written nextChar)Checks whether the next character that is to be written out is a special character that must be quoted. |
| protected void | processCharacter(Appendable
- Appendable holding the processed data. appendable, char Character to process nextChar)Appends the character to the StringBuilder adding the escape character if needed. |
| protected void | processLine(String
Element to process. nextElement, Appendable - Appendable holding the processed data. appendable)Processes all the characters in a line. |
| protected boolean | Returns: True if the line contains the quote, escape, separator, newline, or return.Element of data to check for special characters. line)Checks to see if the line contains special characters. |
| protected void | writeNext(String[] nextLine, boolean applyQuotesToAll, Appendable appendable)
Implements abstract com. Writes the next line to the file. |
| escapechar | back to summary |
|---|---|
| protected final char escapechar | |
| quotechar | back to summary |
|---|---|
| protected final char quotechar | |
| separator | back to summary |
|---|---|
| protected final char separator | |
| CSVWriter | back to summary |
|---|---|
| public CSVWriter(Writer writer) Constructs CSVWriter using a comma for the separator.
| |
| CSVWriter | back to summary |
|---|---|
| public CSVWriter(Writer writer, char separator, char quotechar, char escapechar, String lineEnd) Constructs CSVWriter with supplied separator, quote char, escape char and line ending. | |
| appendQuoteCharacterIfNeeded | back to summary |
|---|---|
| private void appendQuoteCharacterIfNeeded(boolean applyQuotesToAll, Appendable appendable, Boolean stringContainsSpecialCharacters) throws IOException | |
| checkCharactersToEscape | back to summary |
|---|---|
| protected boolean checkCharactersToEscape(char nextChar) Checks whether the next character that is to be written out is a special character that must be quoted. The quote character, escape charater, and separator are special characters.
| |
| processCharacter | back to summary |
|---|---|
| protected void processCharacter(Appendable appendable, char nextChar) throws IOException Appends the character to the StringBuilder adding the escape character if needed.
| |
| processLine | back to summary |
|---|---|
| protected void processLine(String nextElement, Appendable appendable) throws IOException Processes all the characters in a line.
| |
| stringContainsSpecialCharacters | back to summary |
|---|---|
| protected boolean stringContainsSpecialCharacters(String line) Checks to see if the line contains special characters.
| |
| writeNext | back to summary |
|---|---|
| protected void writeNext(String[] nextLine, boolean applyQuotesToAll, Appendable appendable) throws IOException Implements abstract com. Doc from com. Writes the next line to the file. This method is a fail-fast method that will throw the IOException of the writer supplied to the CSVWriter (if the Writer does not handle the exceptions itself like the PrintWriter class).
| |