|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectbiweekly.io.json.JCalWriter
public class JCalWriter
Writes ICalendar objects to a JSON data stream (jCal).
Example:
List<ICalendar> icals = ...
OutputStream out = ...
JCalWriter jcalWriter = new JCalWriter(out);
for (ICalendar ical : icals){
jcalWriter.write(ical);
}
jcalWriter.close();
| Constructor Summary | |
|---|---|
JCalWriter(File file)
Creates a jCal writer that writes to a file. |
|
JCalWriter(File file,
boolean wrapInArray)
Creates a jCal writer that writes to a file. |
|
JCalWriter(OutputStream outputStream)
Creates a jCal writer that writes to an output stream. |
|
JCalWriter(OutputStream outputStream,
boolean wrapInArray)
Creates a jCal writer that writes to an output stream. |
|
JCalWriter(Writer writer)
Creates a jCal writer that writes to a writer. |
|
JCalWriter(Writer writer,
boolean wrapInArray)
Creates a jCal writer that writes to a writer. |
|
| Method Summary | |
|---|---|
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. |
ICalMarshallerRegistrar |
getRegistrar()
Gets the object that manages the component/property marshaller objects. |
boolean |
isIndent()
Gets whether or not the JSON will be pretty-printed. |
void |
registerMarshaller(ICalComponentMarshaller<? extends ICalComponent> marshaller)
Registers an experimental component marshaller. |
void |
registerMarshaller(ICalPropertyMarshaller<? extends ICalProperty> marshaller)
Registers an experimental property marshaller. |
void |
setIndent(boolean indent)
Sets whether or not to pretty-print the JSON. |
void |
setRegistrar(ICalMarshallerRegistrar registrar)
Sets the object that manages the component/property marshaller objects. |
void |
write(ICalendar ical)
Writes an iCalendar object to the data stream. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public JCalWriter(OutputStream outputStream)
outputStream - the output stream to write to
public JCalWriter(OutputStream outputStream,
boolean wrapInArray)
outputStream - the output stream to write towrapInArray - true to wrap all iCalendar objects in a parent array,
false not to (useful when writing more than one iCalendar object)
public JCalWriter(File file)
throws IOException
file - the file to write to
IOException - if the file cannot be written to
public JCalWriter(File file,
boolean wrapInArray)
throws IOException
file - the file to write towrapInArray - true to wrap all iCalendar objects in a parent array,
false not to (useful when writing more than one iCalendar object)
IOException - if the file cannot be written topublic JCalWriter(Writer writer)
writer - the writer to the data stream
public JCalWriter(Writer writer,
boolean wrapInArray)
writer - the writer to the data streamwrapInArray - true to wrap all iCalendar objects in a parent array,
false not to (useful when writing more than one iCalendar object)| Method Detail |
|---|
public void registerMarshaller(ICalPropertyMarshaller<? extends ICalProperty> marshaller)
Registers an experimental property marshaller. Can also be used to override the marshaller of a standard property (such as DTSTART). Calling this method is the same as calling:
getRegistrar().register(marshaller).
marshaller - the marshaller to registerpublic void registerMarshaller(ICalComponentMarshaller<? extends ICalComponent> marshaller)
Registers an experimental component marshaller. Can also be used to override the marshaller of a standard component (such as VEVENT). Calling this method is the same as calling:
getRegistrar().register(marshaller).
marshaller - the marshaller to registerpublic ICalMarshallerRegistrar getRegistrar()
public void setRegistrar(ICalMarshallerRegistrar registrar)
registrar - the marshaller registrarpublic boolean isIndent()
public void setIndent(boolean indent)
indent - true to pretty-print it, false not to (defaults to false)
public void write(ICalendar ical)
throws IOException
ical - the iCalendar object to write
IllegalArgumentException - if the marshaller class for a component
or property object cannot be found (only happens when an experimental
property/component marshaller is not registered with the
registerMarshaller method.)
IOException - if there's a problem writing to the data stream
public void close()
throws IOException
Writer.
close in interface CloseableIOException - if there's a problem closing the stream
public void closeJsonStream()
throws IOException
IOException - if there's a problem writing to the data stream
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||