Package org.apache.juneau.csv
Class CsvWriter
java.lang.Object
java.io.Writer
org.apache.juneau.serializer.SerializerWriter
org.apache.juneau.csv.CsvWriter
- All Implemented Interfaces:
Closeable
,Flushable
,Appendable
,AutoCloseable
Specialized writer for serializing CSV.
Notes:
- This class is not intended for external use.
-
Field Summary
Fields inherited from class org.apache.juneau.serializer.SerializerWriter
maxIndent, out, quoteChar, trimStrings, uriResolver, useWhitespace
-
Constructor Summary
ModifierConstructorDescriptionprotected
CsvWriter
(Writer out, boolean useWhitespace, int maxIndent, char quoteChar, boolean trimStrings, UriResolver uriResolver) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionappend
(char c) append
(int indent, char c) Writes an indent (if theuseWhitespace
setting is enabled), followed by text.Writes an indent (if theuseWhitespace
setting is enabled), followed by text.Writes the specified text to the writer if it isn'tnull .Writes the specified text to the writer if it isn'tnull .appendIf
(boolean b, char c) Writes the specified text to the writer if b is true.Writes the specified text to the writer if b is true.Writes an indent (if theuseWhitespace
setting is enabled), followed by text, followed by a newline (if theuseWhitespace
setting is enabled).Writes the specified text followed by a newline (if theuseWhitespace
setting is enabled).i
(int indent) Writes an indent to the writer if theuseWhitespace
setting is enabled.nl
(int indent) Writes a newline to the writer if theuseWhitespace
setting is enabled.q()
Adds the quote character specified by thequoteChar
setting to the output.s()
Adds a whitespace character to the output if theuseWhitespace
setting is enabled.void
writeEntry
(Object value) Writes an entry to the writer.
-
Constructor Details
-
CsvWriter
protected CsvWriter(Writer out, boolean useWhitespace, int maxIndent, char quoteChar, boolean trimStrings, UriResolver uriResolver) Constructor.- Parameters:
out
- The writer being wrapped.useWhitespace
- Iftrue , tabs and spaces will be used in output.maxIndent
- The maximum indentation level.quoteChar
- The quote character to use (i.e.'\'' or'"' )trimStrings
- Iftrue , strings will be trimmed before being serialized.uriResolver
- The URI resolver for resolving URIs to absolute or root-relative form.
-
-
Method Details
-
writeEntry
Writes an entry to the writer.- Parameters:
value
- The value to write.
-
appendln
Description copied from class:SerializerWriter
Writes an indent (if theuseWhitespace
setting is enabled), followed by text, followed by a newline (if theuseWhitespace
setting is enabled).- Overrides:
appendln
in classSerializerWriter
- Parameters:
indent
- The number of tabs to indent.text
- The text to write.- Returns:
- This object.
-
appendln
Description copied from class:SerializerWriter
Writes the specified text followed by a newline (if theuseWhitespace
setting is enabled).- Overrides:
appendln
in classSerializerWriter
- Parameters:
text
- The text to write.- Returns:
- This object.
-
append
Description copied from class:SerializerWriter
Writes an indent (if theuseWhitespace
setting is enabled), followed by text.- Overrides:
append
in classSerializerWriter
- Parameters:
indent
- The number of tabs to indent.text
- The text to write.- Returns:
- This object.
-
append
Description copied from class:SerializerWriter
Writes an indent (if theuseWhitespace
setting is enabled), followed by text.- Overrides:
append
in classSerializerWriter
- Parameters:
indent
- The number of tabs to indent.c
- The character to write.- Returns:
- This object.
-
s
Description copied from class:SerializerWriter
Adds a whitespace character to the output if theuseWhitespace
setting is enabled.- Overrides:
s
in classSerializerWriter
- Returns:
- This object.
-
q
Description copied from class:SerializerWriter
Adds the quote character specified by thequoteChar
setting to the output.- Overrides:
q
in classSerializerWriter
- Returns:
- This object.
-
i
Description copied from class:SerializerWriter
Writes an indent to the writer if theuseWhitespace
setting is enabled.- Overrides:
i
in classSerializerWriter
- Parameters:
indent
- The number of tabs to indent.- Returns:
- This object.
-
nl
Description copied from class:SerializerWriter
Writes a newline to the writer if theuseWhitespace
setting is enabled.- Overrides:
nl
in classSerializerWriter
- Parameters:
indent
- The current indentation level.- Returns:
- This object.
-
append
Description copied from class:SerializerWriter
Writes the specified text to the writer if it isn'tnull .- Overrides:
append
in classSerializerWriter
- Parameters:
text
- The text to write.- Returns:
- This object.
-
append
Description copied from class:SerializerWriter
Writes the specified text to the writer if it isn'tnull .- Overrides:
append
in classSerializerWriter
- Parameters:
text
- The text to write.- Returns:
- This object.
-
appendIf
Description copied from class:SerializerWriter
Writes the specified text to the writer if b is true.- Overrides:
appendIf
in classSerializerWriter
- Parameters:
b
- Boolean flag.text
- The text to write.- Returns:
- This object.
-
appendIf
Description copied from class:SerializerWriter
Writes the specified text to the writer if b is true.- Overrides:
appendIf
in classSerializerWriter
- Parameters:
b
- Boolean flag.c
- The text to write.- Returns:
- This object.
-
append
- Specified by:
append
in interfaceAppendable
- Overrides:
append
in classSerializerWriter
-