public class ChainingTextWriter extends Object
Ezvcard.write(Collection)
,
Ezvcard.write(VCard...)
Constructor and Description |
---|
ChainingTextWriter(Collection<VCard> vcards) |
Modifier and Type | Method and Description |
---|---|
ChainingTextWriter |
caretEncoding(boolean enable)
Sets whether the writer will use circumflex accent encoding for vCard 3.0
and 4.0 parameter values (disabled by default).
|
ChainingTextWriter |
foldLines(boolean foldLines)
Sets whether to fold long lines.
|
String |
go()
Writes the vCards to a string.
|
void |
go(OutputStream out)
Writes the vCards to an output stream.
|
void |
go(Path file)
Writes the vCards to a file.
|
void |
go(Path file,
boolean append)
Writes the vCards to a file.
|
void |
go(Writer writer)
Writes the vCards to a writer.
|
ChainingTextWriter |
includeTrailingSemicolons(Boolean include)
Sets whether to include trailing semicolon delimiters for structured
property values whose list of values end with null or empty values.
|
ChainingTextWriter |
prodId(boolean include)
Sets whether to add a
ProductId property to each vCard that marks
it as having been generated by this library. |
ChainingTextWriter |
register(VCardPropertyScribe<? extends VCardProperty> scribe)
Registers a property scribe.
|
ChainingTextWriter |
targetApplication(TargetApplication targetApplication)
Sets the application that the vCards will be targeted for.
|
ChainingTextWriter |
version(VCardVersion version)
Sets the version that all the vCards will be marshalled to.
|
ChainingTextWriter |
versionStrict(boolean versionStrict)
Sets whether to exclude properties that do not support the target version
from the written vCard.
|
public ChainingTextWriter(Collection<VCard> vcards)
vcards
- the vCards to writepublic ChainingTextWriter version(VCardVersion version)
Sets the version that all the vCards will be marshalled to. The version
that is attached to each individual VCard
object will be ignored.
If no version is passed into this method, the writer will look at the
version attached to each individual VCard
object and marshal it
to that version. And if a VCard
object has no version attached to
it, then it will be marshalled to version 3.0.
version
- the version to marshal the vCards topublic ChainingTextWriter caretEncoding(boolean enable)
enable
- true to use circumflex accent encoding, false not toVCardWriter.setCaretEncodingEnabled(boolean)
,
RFC 6868public ChainingTextWriter includeTrailingSemicolons(Boolean include)
Sets whether to include trailing semicolon delimiters for structured
property values whose list of values end with null or empty values.
Examples of properties that use structured values are
StructuredName
and Address
.
This setting exists for compatibility reasons and should not make a difference to consumers that correctly implement the vCard grammar.
include
- true to include the trailing semicolons, false not to,
null to use the default behavior (defaults to false for vCard versions
2.1 and 3.0 and true for vCard version 4.0)public ChainingTextWriter foldLines(boolean foldLines)
Sets whether to fold long lines. Line folding is when long lines are split up into multiple lines. No data is lost or changed when a line is folded.
Line folding is enabled by default. If the vCard consumer is not parsing your vCards properly, disabling line folding may help.
foldLines
- true to enable line folding, false to disable it
(defaults to true)public ChainingTextWriter targetApplication(TargetApplication targetApplication)
Sets the application that the vCards will be targeted for.
Some vCard consumers do not completely adhere to the vCard specifications
and require their vCards to be formatted in a specific way. See the
TargetApplication
class for a list of these applications.
targetApplication
- the target application or null if the vCards do
not require any special processing (defaults to null)VCardWriter.setTargetApplication(TargetApplication)
public ChainingTextWriter prodId(boolean include)
ProductId
property to each vCard that marks
it as having been generated by this library. For 2.1 vCards, the extended
property "X-PRODID" will be added, since ProductId
is not
supported by that version.include
- true to add the property, false not to (defaults to true)public ChainingTextWriter versionStrict(boolean versionStrict)
versionStrict
- true to exclude such properties, false not to
(defaults to true)public ChainingTextWriter register(VCardPropertyScribe<? extends VCardProperty> scribe)
scribe
- the scribe to registerpublic void go(OutputStream out) throws IOException
out
- the output stream to write toIOException
- if there's a problem writing to the output streampublic void go(Path file) throws IOException
file
- the file to write toIOException
- if there's a problem writing to the filepublic void go(Path file, boolean append) throws IOException
file
- the file to write toappend
- true to append onto the end of the file, false to overwrite
itIOException
- if there's a problem writing to the filepublic void go(Writer writer) throws IOException
writer
- the writer to write toIOException
- if there's a problem writing to the writerCopyright © 2012–2023 Michael Angstadt. All rights reserved.