public class ICalendar extends ICalComponent
Represents an iCalendar object.
Examples:
ICalendar ical = new ICalendar(); VEvent event = new VEvent(); event.setSummary("Team Meeting"); Date start = ...; event.setDateStart(start); Date end = ...; event.setDateEnd(end); ical.addEvent(event);
components, properties
Constructor and Description |
---|
ICalendar()
Creates a new iCalendar object.
|
Modifier and Type | Method and Description |
---|---|
void |
addEvent(VEvent event)
Adds an event.
|
void |
addFreeBusy(VFreeBusy freeBusy)
Adds a free/busy entry.
|
void |
addJournal(VJournal journal)
Adds a journal entry.
|
void |
addTodo(VTodo todo)
Adds a to-do.
|
CalendarScale |
getCalendarScale()
Gets the calendar system that this iCalendar object uses.
|
List<VEvent> |
getEvents()
Gets the events.
|
List<VFreeBusy> |
getFreeBusies()
Gets the free/busy entries.
|
List<VJournal> |
getJournals()
Gets the journal entries.
|
Method |
getMethod()
Gets the value of the Content-Type "method" parameter if the iCalendar
object is defined as a MIME message entity.
|
ProductId |
getProductId()
Gets the name of the application that created the iCalendar object.
|
List<VTodo> |
getTodos()
Gets the to-dos.
|
ICalVersion |
getVersion()
Gets the version of this iCalendar object.
|
void |
setCalendarScale(CalendarScale calendarScale)
Sets the calendar system that this iCalendar object uses.
|
void |
setMethod(Method method)
Sets the value of the Content-Type "method" parameter if the iCalendar
object is defined as a MIME message entity.
|
Method |
setMethod(String method)
Sets the value of the Content-Type "method" parameter if the iCalendar
object is defined as a MIME message entity.
|
void |
setProductId(ProductId prodId)
Sets the name of the application that created the iCalendar object.
|
ProductId |
setProductId(String prodId)
Sets the application that created the iCalendar object.
|
void |
setVersion(ICalVersion version)
Sets the version of this iCalendar object.
|
ValidationWarnings |
validate(ICalVersion version)
Checks this iCalendar object for data consistency problems or deviations
from the spec.
|
protected void |
validate(List<ICalComponent> components,
ICalVersion version,
List<Warning> warnings)
Checks the component for data consistency problems or deviations from the
spec.
|
String |
write()
Marshals this iCalendar object to its plain text representation.
|
void |
write(File file)
Marshals this iCalendar object to its plain text representation.
|
void |
write(OutputStream out)
Marshals this iCalendar object to its plain text representation.
|
void |
write(Writer writer)
Marshals this iCalendar object to its plain text representation.
|
String |
writeJson()
Marshals this iCalendar object to its JSON representation (jCal).
|
void |
writeJson(File file)
Marshals this iCalendar object to its JSON representation (jCal).
|
void |
writeJson(OutputStream out)
Marshals this iCalendar object to its JSON representation (jCal).
|
void |
writeJson(Writer writer)
Marshals this iCalendar object to its JSON representation (jCal).
|
String |
writeXml()
Marshals this iCalendar object to its XML representation (xCal).
|
void |
writeXml(File file)
Marshals this iCalendar object to its XML representation (xCal).
|
void |
writeXml(OutputStream out)
Marshals this iCalendar object to its XML representation (xCal).
|
void |
writeXml(Writer writer)
Marshals this iCalendar object to its XML representation (xCal).
|
addComponent, addExperimentalComponent, addExperimentalProperty, addExperimentalProperty, addProperty, checkOptionalCardinality, checkRequiredCardinality, checkStatus, getComponent, getComponents, getComponents, getExperimentalComponent, getExperimentalComponents, getExperimentalComponents, getExperimentalProperties, getExperimentalProperties, getExperimentalProperty, getProperties, getProperties, getProperty, removeComponents, removeExperimentalComponents, removeExperimentalProperty, removeProperties, setComponent, setComponent, setExperimentalComponents, setExperimentalProperty, setExperimentalProperty, setProperty, setProperty, validate
public ICalVersion getVersion()
public void setVersion(ICalVersion version)
version
- the versionpublic ProductId getProductId()
ICalendar
objects are initialized with a product ID representing
this library. It is a required property.public void setProductId(ProductId prodId)
ICalendar
objects are initialized with a product ID representing
this library. It is a required property.prodId
- the property instance or null to removepublic ProductId setProductId(String prodId)
ICalendar
objects are initialized with a product ID representing
this library.prodId
- a unique string representing the application (e.g.
"-//Company//Application//EN") or null to removepublic CalendarScale getCalendarScale()
public void setCalendarScale(CalendarScale calendarScale)
calendarScale
- the calendar system or null to removepublic Method getMethod()
public void setMethod(Method method)
method
- the property or null to removepublic Method setMethod(String method)
method
- the method or null to removepublic List<VEvent> getEvents()
public void addEvent(VEvent event)
event
- the eventpublic List<VTodo> getTodos()
public void addTodo(VTodo todo)
todo
- the to-dopublic List<VJournal> getJournals()
public void addJournal(VJournal journal)
journal
- the journal entrypublic List<VFreeBusy> getFreeBusies()
public void addFreeBusy(VFreeBusy freeBusy)
freeBusy
- the free/busy entrypublic ValidationWarnings validate(ICalVersion version)
version
- the version to validate againstprotected void validate(List<ICalComponent> components, ICalVersion version, List<Warning> warnings)
ICalComponent
Checks the component for data consistency problems or deviations from the spec.
This method should be overridden by child classes that wish to provide validation logic. The default implementation of this method does nothing.
validate
in class ICalComponent
components
- the hierarchy of components that the component belongs
toversion
- the version to validate againstwarnings
- the list to add the warnings topublic String write()
public void write(File file) throws IOException
file
- the file to write toIOException
- if there's an I/O problempublic void write(OutputStream out) throws IOException
out
- the data stream to write toIOException
- if there's an I/O problempublic void write(Writer writer) throws IOException
writer
- the data stream to write toIOException
- if there's an I/O problempublic String writeXml()
Biweekly
class instead, in order to register the scribe
classes.IllegalArgumentException
- if the iCalendar object contains
user-defined property or component objectspublic void writeXml(File file) throws TransformerException, IOException
Biweekly
class instead, in order to register the scribe
classes.file
- the file to write toIllegalArgumentException
- if the iCalendar object contains
user-defined property or component objectsTransformerException
- if there's an I/O problemIOException
- if the file cannot be written topublic void writeXml(OutputStream out) throws TransformerException
Biweekly
class instead, in order to register the scribe
classes.out
- the data stream to write toIllegalArgumentException
- if the iCalendar object contains
user-defined property or component objectsTransformerException
- if there's an I/O problempublic void writeXml(Writer writer) throws TransformerException
Biweekly
class instead, in order to register the scribe
classes.writer
- the data stream to write toIllegalArgumentException
- if the iCalendar object contains
user-defined property or component objectsTransformerException
- if there's an I/O problempublic String writeJson()
Biweekly
class instead, in order to register the scribe
classes.IllegalArgumentException
- if the iCalendar object contains
user-defined property or component objectspublic void writeJson(File file) throws IOException
Biweekly
class instead, in order to register the scribe
classes.file
- the file to write toIllegalArgumentException
- if the iCalendar object contains
user-defined property or component objectsIOException
- if there's a problem writing to the filepublic void writeJson(OutputStream out) throws IOException
Biweekly
class instead, in order to register the scribe
classes.out
- the data stream to write toIllegalArgumentException
- if the iCalendar object contains
user-defined property or component objectsIOException
- if there's a problem writing to the output streampublic void writeJson(Writer writer) throws IOException
Biweekly
class instead, in order to register the scribe
classes.writer
- the data stream to write toIllegalArgumentException
- if the iCalendar object contains
user-defined property or component objectsIOException
- if there's a problem writing to the writerCopyright © 2013-2015 Michael Angstadt. All Rights Reserved.