Top Description Constructors Methods
net.fortuna.ical4j.util

public final Class Calendars

extends Object
Class Inheritance
Imports
net.fortuna.ical4j.data.CalendarBuilder, .ParserException, net.fortuna.ical4j.model.Calendar, net.fortuna.ical4j.model.*, net.fortuna.ical4j.model.component.CalendarComponent, .VTimeZone, net.fortuna.ical4j.model.parameter.TzId, net.fortuna.ical4j.model.property.Method, .Uid, java.io.IOException, java.net.URL, java.nio.charset.Charset, java.nio.file.Files, .Paths, java.util.*

$Id$ Created on 10/11/2006 Utility method for working with Calendars.
Author
Ben Fortuna

Constructor Summary

AccessConstructor and Description
private
Calendars()

Constructor made private to enforce static nature.

Method Summary

Modifier and TypeMethod and Description
public static String

Returns:

a content type string
getContentType
(Calendar
a calendar instance
calendar
,
Charset
an optional encoding
charset
)

Returns an appropriate MIME Content-Type for the specified calendar object.

public static Uid

Returns:

the UID property
getUid
(final Calendar
a calendar instance
calendar
)
Deprecated @see Calendar#getUid()

Returns a unique identifier as specified by components in the provided calendar.

public static Calendar

Returns:

returns a new calendar instance initialised from the specified file
load
(final String
the name of the file from which to load calendar data
filename
)

Loads a calendar from the specified file.

public static Calendar

Returns:

returns a new calendar instance initialised from the specified URL
load
(final URL
the URL from which to load calendar data
url
)

Loads a calendar from the specified URL.

public static Calendar

Returns:

a Calendar instance containing all properties and components from the specified calendars
merge
(Calendar...
zero or more calendars to merge
calendars
)

Merge all properties and components from multiple calendars into one instance.

public static Calendar[]

Returns:

an array of calendar objects
split
(final Calendar
a calendar instance
calendar
)
Deprecated @see Calendar#split()

Splits a calendar object into distinct calendar objects for unique identifers (UID).

public static Calendar

Returns:

a calendar containing the specified component
wrap
(final CalendarComponent...
the component to wrap with a calendar
component
)

Wraps a component in a calendar.

public static Calendar
wrap(PropertyList properties, final CalendarComponent... component)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Calendarsback to summary
private Calendars()

Constructor made private to enforce static nature.

Method Detail

getContentTypeback to summary
public static String getContentType(Calendar calendar, Charset charset)

Returns an appropriate MIME Content-Type for the specified calendar object.

Parameters
calendar:Calendar

a calendar instance

charset:Charset

an optional encoding

Returns:String

a content type string

Annotations
@Deprecated
getUidback to summary
public static Uid getUid(final Calendar calendar) throws ConstraintViolationException

Deprecated

@see Calendar#getUid()

Returns a unique identifier as specified by components in the provided calendar.

Parameters
calendar:Calendar

a calendar instance

Returns:Uid

the UID property

Annotations
@Deprecated
Exceptions
ConstraintViolationException:
if zero or more than one unique identifer is found in the specified calendar
loadback to summary
public static Calendar load(final String filename) throws IOException, ParserException

Loads a calendar from the specified file.

Parameters
filename:String

the name of the file from which to load calendar data

Returns:Calendar

returns a new calendar instance initialised from the specified file

Exceptions
IOException:
occurs when there is an error reading the specified file
ParserException:
occurs when the data in the specified file is invalid
loadback to summary
public static Calendar load(final URL url) throws IOException, ParserException

Loads a calendar from the specified URL.

Parameters
url:URL

the URL from which to load calendar data

Returns:Calendar

returns a new calendar instance initialised from the specified URL

Exceptions
IOException:
occurs when there is an error reading from the specified URL
ParserException:
occurs when the data in the specified URL is invalid
mergeback to summary
public static Calendar merge(Calendar... calendars)

Merge all properties and components from multiple 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).

Parameters
calendars:Calendar[]

zero or more calendars to merge

Returns:Calendar

a Calendar instance containing all properties and components from the specified calendars

splitback to summary
public static Calendar[] split(final Calendar calendar)

Deprecated

@see Calendar#split()

Splits a calendar object into distinct calendar objects for unique identifers (UID).

Parameters
calendar:Calendar

a calendar instance

Returns:Calendar[]

an array of calendar objects

Annotations
@Deprecated
wrapback to summary
public static Calendar wrap(final CalendarComponent... component)

Wraps a component in a calendar.

Parameters
component:CalendarComponent[]

the component to wrap with a calendar

Returns:Calendar

a calendar containing the specified component

wrapback to summary
public static Calendar wrap(PropertyList properties, final CalendarComponent... component)