public class JCalRawWriter extends Object implements Closeable, Flushable
Constructor and Description |
---|
JCalRawWriter(JsonGenerator generator) |
JCalRawWriter(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(PrettyPrinter prettyPrinter)
Sets the pretty printer to pretty-print the JSON with.
|
void |
writeEndComponent()
Closes the current component array.
|
void |
writeProperty(String propertyName,
ICalDataType dataType,
JCalValue value)
Writes a property to the current component.
|
void |
writeProperty(String propertyName,
ICalParameters parameters,
ICalDataType dataType,
JCalValue value)
Writes a property to the current component.
|
void |
writeStartComponent(String componentName)
Writes the beginning of a new component array.
|
public JCalRawWriter(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 iCalendar object)public JCalRawWriter(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(PrettyPrinter prettyPrinter)
setPrettyPrint(true)
does
not also need to be called.prettyPrinter
- the custom pretty printer (defaults to an instance
of JCalPrettyPrinter
, if setPrettyPrint(true)
has been
called)public void writeStartComponent(String componentName) throws IOException
componentName
- the component name (e.g. "vevent")IOException
- if there's an I/O problempublic void writeEndComponent() throws IOException
IllegalStateException
- if there are no open components (
writeStartComponent(String)
must be called first)IOException
- if there's an I/O problempublic void writeProperty(String propertyName, ICalDataType dataType, JCalValue value) throws IOException
propertyName
- the property name (e.g. "version")dataType
- the property's data type (e.g. "text")value
- the property valueIllegalStateException
- if there are no open components (
writeStartComponent(String)
must be called first) or if the last
method called was writeEndComponent()
.IOException
- if there's an I/O problempublic void writeProperty(String propertyName, ICalParameters parameters, ICalDataType dataType, JCalValue value) throws IOException
propertyName
- the property name (e.g. "version")parameters
- the parametersdataType
- the property's data type (e.g. "text")value
- the property valueIllegalStateException
- if there are no open components (
writeStartComponent(String)
must be called first) or if the last
method called was writeEndComponent()
.IOException
- if there's an I/O problempublic void flush() throws IOException
flush
in interface Flushable
IOException
- if there's a problem flushing the streampublic void closeJsonStream() throws IOException
IOException
- if there's a problem closing the streampublic void close() throws IOException
Writer
.close
in interface Closeable
close
in interface AutoCloseable
IOException
- if there's a problem closing the streamCopyright © 2013-2016 Michael Angstadt. All Rights Reserved.