DefaultCharAppender class to include facilities for writing to an output. Used by writers extending AbstractWriter.
This class introduces the handling of the normalized newline character defined in Format#getNormalizedNewline() and converts it to the newline sequence in Format#getLineSeparator()
It also introduces methods to write to an instance of java. directly to avoid unnecessary String instantiations.
com.univocity.parsers.common.Format , com.univocity.parsers.common.AbstractWriter
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private final char | |
| private final char | |
| private final char |
| Access | Constructor and Description |
|---|---|
| public | WriterCharAppender(int
maximum limit of characters to append maxLength, String default value to return when no characters have been accumulated emptyValue, int starting range of characters considered to be whitespace. whitespaceRangeStart, Format output format specification used for newline handling format)Creates a WriterCharAppender with:
|
| Modifier and Type | Method and Description |
|---|---|
| public final void | append(char
the character to append ch)Overrides com. Implements com. |
| public final void | appendIgnoringPadding(char
character to append ch, char the padding character padding)Overrides com. Implements com. If the given character is equal to |
| public final void | appendIgnoringWhitespace(char
character to append ch)Overrides com. Implements com. ch <= ' ')
If the given character is equal to |
| public final void | appendIgnoringWhitespaceAndPadding(char
character to append ch, char the padding character padding)Overrides com. Implements com. ch <= ' ') or a padding character
If the given character is equal to |
| public final void | |
| public final void | enableDenormalizedLineEndings(boolean
flag indicating whether denormalized line endings are allowed. The writer
won't convert line separators automatically. enableDenormalizedLineEndings)Configures the appender to allow line ending sequences to be appended as-is, without replacing them by the normalized line separator character. |
| public final void | writeCharsAndReset(Writer
the output writer writer)Writes the accumulated value to the The internal accumulated value is discarded after invoking this method (as in If the accumulated value is empty (i.e. no characters were appended, or all appended characters where ignored as whitespace or padding), then the written value will be the |
| denormalizeLineEndings | back to summary |
|---|---|
| private boolean denormalizeLineEndings | |
| lineSeparator1 | back to summary |
|---|---|
| private final char lineSeparator1 | |
| lineSeparator2 | back to summary |
|---|---|
| private final char lineSeparator2 | |
| newLine | back to summary |
|---|---|
| private final char newLine | |
| WriterCharAppender | back to summary |
|---|---|
| public WriterCharAppender(int maxLength, String emptyValue, int whitespaceRangeStart, Format format) Creates a WriterCharAppender with:
| |
| append | back to summary |
|---|---|
| public final void append(char ch) Overrides com. Implements com. Appends the given character. If the given character is equal to
| |
| appendIgnoringPadding | back to summary |
|---|---|
| public final void appendIgnoringPadding(char ch, char padding) Overrides com. Implements com. Appends the given character and marks it as ignored if it is a padding character If the given character is equal to
| |
| appendIgnoringWhitespace | back to summary |
|---|---|
| public final void appendIgnoringWhitespace(char ch) Overrides com. Implements com. Appends the given character and marks it as ignored if it is a whitespace ( If the given character is equal to
| |
| appendIgnoringWhitespaceAndPadding | back to summary |
|---|---|
| public final void appendIgnoringWhitespaceAndPadding(char ch, char padding) Overrides com. Implements com. Appends the given character and marks it as ignored if it is a whitespace ( If the given character is equal to
| |
| appendNewLine | back to summary |
|---|---|
| public final void appendNewLine() Appends the newline character sequence specified in | |
| enableDenormalizedLineEndings | back to summary |
|---|---|
| public final void enableDenormalizedLineEndings(boolean enableDenormalizedLineEndings) Configures the appender to allow line ending sequences to be appended as-is, without replacing them by the normalized line separator character.
| |
| writeCharsAndReset | back to summary |
|---|---|
| public final void writeCharsAndReset(Writer writer) throws IOException Writes the accumulated value to the The internal accumulated value is discarded after invoking this method (as in If the accumulated value is empty (i.e. no characters were appended, or all appended characters where ignored as whitespace or padding), then the written value will be the
| |