net.fortuna.ical4j.util
Class Calendars
java.lang.Object
net.fortuna.ical4j.util.Calendars
public final class Calendars
extends java.lang.Object
$Id: Calendars.java,v 1.9 2008/12/16 12:34:53 fortuna Exp $
Created on 10/11/2006
Utility method for working with Calendar
s.
static Uid | getUid(Calendar calendar) - Returns a unique identifier as specified by components in the provided calendar.
|
static Calendar | load(String filename) - Loads a calendar from the specified file.
|
static Calendar | load(URL url) - Loads a calendar from the specified URL.
|
static Calendar | merge(Calendar c1, Calendar c2) - Merge all properties and components from two specified calendars into one instance.
|
static Calendar[] | split(Calendar calendar) - Splits a calendar object into distinct calendar objects for unique
identifers (UID).
|
static Calendar | wrap(Component component) - Wraps a component in a calendar.
|
getUid
public static Uid getUid(Calendar calendar)
throws ConstraintViolationException
Returns a unique identifier as specified by components in the provided calendar.
load
public static Calendar load(String filename)
throws IOException,
ParserException
Loads a calendar from the specified file.
filename
- the name of the file from which to load calendar data
- returns a new calendar instance initialised from the specified file
load
public static Calendar load(URL url)
throws IOException,
ParserException
Loads a calendar from the specified URL.
url
- the URL from which to load calendar data
- returns a new calendar instance initialised from the specified URL
merge
public static Calendar merge(Calendar c1,
Calendar c2)
Merge all properties and components from two specified calendars into one instance.
Note that the merge process is not very sophisticated, and may result in invalid calendar
data (e.g. multiple properties of a type that should only be specified once).
c1
- the first calendar to mergec2
- the second calendar to merge
- a Calendar instance containing all properties and components from both of the specified calendars
split
public static Calendar[] split(Calendar calendar)
Splits a calendar object into distinct calendar objects for unique
identifers (UID).
wrap
public static Calendar wrap(Component component)
Wraps a component in a calendar.
component
- the component to wrap with a calendar
- a calendar containing the specified component