public class ChainingJsonWriter extends Object
Ezvcard.writeJson(Collection)
,
Ezvcard.writeJson(VCard...)
Constructor and Description |
---|
ChainingJsonWriter(Collection<VCard> vcards) |
Modifier and Type | Method and Description |
---|---|
String |
go()
Writes the jCards to a string.
|
void |
go(OutputStream out)
Writes the jCards to an output stream.
|
void |
go(Path file)
Writes the jCards to a file.
|
void |
go(Writer writer)
Writes the jCards to a writer.
|
ChainingJsonWriter |
prettyPrint(boolean prettyPrint)
Sets whether or not to pretty-print the JSON.
|
ChainingJsonWriter |
prodId(boolean include)
Sets whether to add a
ProductId property to each vCard that marks
it as having been generated by this library. |
ChainingJsonWriter |
register(VCardPropertyScribe<? extends VCardProperty> scribe)
Registers a property scribe.
|
ChainingJsonWriter |
versionStrict(boolean versionStrict)
Sets whether to exclude properties that do not support the target version
from the written vCard.
|
public ChainingJsonWriter(Collection<VCard> vcards)
vcards
- the vCards to writepublic ChainingJsonWriter prettyPrint(boolean prettyPrint)
prettyPrint
- true to pretty-print it, false not to (defaults to
false)public ChainingJsonWriter 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 ChainingJsonWriter versionStrict(boolean versionStrict)
versionStrict
- true to exclude such properties, false not to
(defaults to true)public ChainingJsonWriter 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(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.