public class JCalRawWriter extends Object implements Closeable, Flushable
Constructor and Description |
---|
JCalRawWriter(Writer writer,
boolean wrapInArray)
Creates a new raw writer.
|
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 |
isIndent()
Gets whether or not the JSON will be pretty-printed.
|
void |
setIndent(boolean indent)
Sets whether or not to pretty-print the JSON.
|
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 the data streamwrapInArray
- true to wrap everything in an array, false not to
(useful when writing more than one iCalendar object)public boolean isIndent()
public void setIndent(boolean indent)
indent
- true to pretty-print it, false not to (defaults to false)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-2015 Michael Angstadt. All Rights Reserved.