public class JCardRawWriter extends Object implements Closeable, Flushable
| Constructor and Description |
|---|
JCardRawWriter(com.fasterxml.jackson.core.JsonGenerator generator) |
JCardRawWriter(Writer writer,
boolean wrapInArray) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Finishes writing the JSON document and closes the underlying
Writer. |
void |
closeJsonStream()
Finishes writing the JSON document so that it is syntactically correct.
|
void |
flush()
Flushes the JSON stream.
|
boolean |
isPrettyPrint()
Gets whether or not the JSON will be pretty-printed.
|
void |
setPrettyPrint(boolean prettyPrint)
Sets whether or not to pretty-print the JSON.
|
void |
setPrettyPrinter(com.fasterxml.jackson.core.PrettyPrinter prettyPrinter)
Sets the pretty printer to pretty-print the JSON with.
|
void |
writeEndVCard()
Closes the "vcard" component array.
|
void |
writeProperty(String group,
String propertyName,
VCardParameters parameters,
VCardDataType dataType,
JCardValue value)
Writes a property to the current vCard.
|
void |
writeProperty(String propertyName,
VCardDataType dataType,
JCardValue value)
Writes a property to the current component.
|
void |
writeStartVCard()
Writes the beginning of a new "vcard" component.
|
public JCardRawWriter(Writer writer, boolean wrapInArray)
writer - the writer to wrapwrapInArray - true to wrap everything in an array, false not to
(useful when writing more than one vCard)public JCardRawWriter(com.fasterxml.jackson.core.JsonGenerator generator)
generator - the generator to write topublic boolean isPrettyPrint()
public void setPrettyPrint(boolean prettyPrint)
prettyPrint - true to pretty-print it, false not to (defaults to
false)public void setPrettyPrinter(com.fasterxml.jackson.core.PrettyPrinter prettyPrinter)
setPrettyPrint(true) does
not also need to be called.prettyPrinter - the custom pretty printer (defaults to an instance
of JCardPrettyPrinter, if setPrettyPrint(true) has been
called)public void writeStartVCard() throws IOException
IOException - if there's a problem writing to the output streampublic void writeEndVCard() throws IOException
IllegalStateException - if the component was never opened (
writeStartVCard() must be called first)IOException - if there's a problem writing to the output streampublic void writeProperty(String propertyName, VCardDataType dataType, JCardValue value) throws IOException
propertyName - the property name (e.g. "version")dataType - the data type or null for "unknown"value - the property valueIllegalStateException - if the "vcard" component was never opened
or was just closed (writeStartVCard() must be called first)IOException - if there's a problem writing to the output streampublic void writeProperty(String group, String propertyName, VCardParameters parameters, VCardDataType dataType, JCardValue value) throws IOException
group - the group or null if there is no grouppropertyName - the property name (e.g. "version")parameters - the parametersdataType - the data type or null for "unknown"value - the property valueIllegalStateException - if the "vcard" component was never opened
or was just closed (writeStartVCard() must be called first)IOException - if there's a problem writing to the output streampublic void flush() throws IOException
flush in interface FlushableIOException - if there's a problem writing to the output streampublic void closeJsonStream() throws IOException
IOException - if there's a problem closing the output streampublic void close() throws IOException
Writer.close in interface Closeableclose in interface AutoCloseableIOException - if there's a problem closing the output streamCopyright © 2012–2023 Michael Angstadt. All rights reserved.