Top Description Fields Constructors Methods
net.fortuna.ical4j.data

public Class CalendarBuilder

extends Object
Class Inheritance
Imports
net.fortuna.ical4j.model.*, java.io.IOException, .InputStream, .InputStreamReader, .Reader, java.nio.charset.Charset, .StandardCharsets, java.util.List, java.util.function.Supplier

Parses and builds an iCalendar model from an input stream. Note that this class is not thread-safe.
Author
Ben Fortuna

                        $Id$

                        Created: Apr 5, 2004
                        
Version
2.0

Field Summary

Modifier and TypeField and Description
private Calendar
calendar

The calendar instance created by the builder.

private final ContentHandler
private static final Charset
private final CalendarParser
private final TimeZoneRegistry

Constructor Summary

AccessConstructor and Description
public
CalendarBuilder()

Default constructor.

public
CalendarBuilder(final CalendarParser
a calendar parser used to parse calendar files
parser
)

Constructs a new calendar builder using the specified calendar parser.

public
CalendarBuilder(final TimeZoneRegistry
a timezone registry to populate with discovered timezones
tzRegistry
)

Constructs a new calendar builder using the specified timezone registry.

public
CalendarBuilder(CalendarParser
a calendar parser used to construct the calendar
parser
,
TimeZoneRegistry
a timezone registry used to retrieve TimeZones and register additional timezone information found in the calendar
tzRegistry
)

Constructs a new instance using the specified parser and registry.

public
CalendarBuilder(CalendarParser
a custom calendar parser
parser
,
PropertyFactoryRegistry propertyFactoryRegistry, ParameterFactoryRegistry parameterFactoryRegistry, TimeZoneRegistry
a custom timezone registry
tzRegistry
)
Deprecated

public
CalendarBuilder(CalendarParser
a custom calendar parser
parser
,
Supplier<List<ParameterFactory<?>>> parameterFactorySupplier, Supplier<List<PropertyFactory<?>>> propertyFactorySupplier, Supplier<List<ComponentFactory<?>>> componentFactorySupplier, TimeZoneRegistry
a custom timezone registry
tzRegistry
)

public
CalendarBuilder(CalendarParser
a custom calendar parser
parser
,
ContentHandlerContext contentHandlerContext, TimeZoneRegistry
a custom timezone registry
tzRegistry
)

Method Summary

Modifier and TypeMethod and Description
public Calendar

Returns:

a calendar parsed from the specified input stream
build
(final InputStream
an input stream to read calendar data from
in
)

Builds an iCalendar model from the specified input stream.

public Calendar

Returns:

a calendar parsed from the specified reader
build
(final Reader
a reader to read calendar data from
in
)

Builds an iCalendar model from the specified reader.

public Calendar

Returns:

a calendar parsed from the specified reader
build
(final UnfoldingReader
an unfolding reader to read data from
uin
)

Build an iCalendar model by parsing data from the specified reader.

public final TimeZoneRegistry

Returns:

a timezone registry
getRegistry
()

Returns the timezone registry used in the construction of calendars.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

calendarback to summary
private Calendar calendar

The calendar instance created by the builder.

contentHandlerback to summary
private final ContentHandler contentHandler
DEFAULT_CHARSETback to summary
private static final Charset DEFAULT_CHARSET
parserback to summary
private final CalendarParser parser
tzRegistryback to summary
private final TimeZoneRegistry tzRegistry

Constructor Detail

CalendarBuilderback to summary
public CalendarBuilder()

Default constructor.

CalendarBuilderback to summary
public CalendarBuilder(final CalendarParser parser)

Constructs a new calendar builder using the specified calendar parser.

Parameters
parser:CalendarParser

a calendar parser used to parse calendar files

CalendarBuilderback to summary
public CalendarBuilder(final TimeZoneRegistry tzRegistry)

Constructs a new calendar builder using the specified timezone registry.

Parameters
tzRegistry:TimeZoneRegistry

a timezone registry to populate with discovered timezones

CalendarBuilderback to summary
public CalendarBuilder(CalendarParser parser, TimeZoneRegistry tzRegistry)

Constructs a new instance using the specified parser and registry.

Parameters
parser:CalendarParser

a calendar parser used to construct the calendar

tzRegistry:TimeZoneRegistry

a timezone registry used to retrieve TimeZones and register additional timezone information found in the calendar

CalendarBuilderback to summary
public CalendarBuilder(CalendarParser parser, PropertyFactoryRegistry propertyFactoryRegistry, ParameterFactoryRegistry parameterFactoryRegistry, TimeZoneRegistry tzRegistry)

Deprecated

Parameters
parser:CalendarParser

a custom calendar parser

tzRegistry:TimeZoneRegistry

a custom timezone registry

Annotations
@Deprecated
CalendarBuilderback to summary
public CalendarBuilder(CalendarParser parser, Supplier<List<ParameterFactory<?>>> parameterFactorySupplier, Supplier<List<PropertyFactory<?>>> propertyFactorySupplier, Supplier<List<ComponentFactory<?>>> componentFactorySupplier, TimeZoneRegistry tzRegistry)
Parameters
parser:CalendarParser

a custom calendar parser

tzRegistry:TimeZoneRegistry

a custom timezone registry

Annotations
@Deprecated
CalendarBuilderback to summary
public CalendarBuilder(CalendarParser parser, ContentHandlerContext contentHandlerContext, TimeZoneRegistry tzRegistry)
Parameters
parser:CalendarParser

a custom calendar parser

tzRegistry:TimeZoneRegistry

a custom timezone registry

Method Detail

buildback to summary
public Calendar build(final InputStream in) throws IOException, ParserException

Builds an iCalendar model from the specified input stream.

Parameters
in:InputStream

an input stream to read calendar data from

Returns:Calendar

a calendar parsed from the specified input stream

Exceptions
IOException:
where an error occurs reading data from the specified stream
ParserException:
where an error occurs parsing data from the stream
buildback to summary
public Calendar build(final Reader in) throws IOException, ParserException

Builds an iCalendar model from the specified reader. An UnfoldingReader is applied to the specified reader to ensure the data stream is correctly unfolded where appropriate.

Parameters
in:Reader

a reader to read calendar data from

Returns:Calendar

a calendar parsed from the specified reader

Exceptions
IOException:
where an error occurs reading data from the specified reader
ParserException:
where an error occurs parsing data from the reader
buildback to summary
public Calendar build(final UnfoldingReader uin) throws IOException, ParserException

Build an iCalendar model by parsing data from the specified reader.

Parameters
uin:UnfoldingReader

an unfolding reader to read data from

Returns:Calendar

a calendar parsed from the specified reader

Exceptions
IOException:
where an error occurs reading data from the specified reader
ParserException:
where an error occurs parsing data from the reader
getRegistryback to summary
public final TimeZoneRegistry getRegistry()

Returns the timezone registry used in the construction of calendars.

Returns:TimeZoneRegistry

a timezone registry