net.fortuna.ical4j.data
Class CalendarBuilder

java.lang.Object
  extended bynet.fortuna.ical4j.data.CalendarBuilder
All Implemented Interfaces:
ContentHandler

public class CalendarBuilder
extends Object
implements ContentHandler

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

Version:
2.0
Author:
Ben Fortuna

Field Summary
protected  Calendar calendar
           
protected  Component component
           
protected  Property property
           
protected  Component subComponent
           
 
Constructor Summary
CalendarBuilder()
          Default constructor.
CalendarBuilder(CalendarParser parser)
          Constructs a new calendar builder using the specified calendar parser.
CalendarBuilder(CalendarParser parser, TimeZoneRegistry registry)
          Constructs a new instance using the specified parser and registry.
CalendarBuilder(TimeZoneRegistry registry)
          Constructs a new calendar builder using the specified timezone registry.
 
Method Summary
 Calendar build(InputStream in)
          Builds an iCalendar model from the specified input stream.
 Calendar build(Reader in)
          Builds an iCalendar model from the specified reader.
 Calendar build(UnfoldingReader uin)
          Build an iCalendar model by parsing data from the specified reader.
 void endCalendar()
          Triggers the end of handling a calendar.
 void endComponent(String name)
          Triggers the end of handling a component.
 void endProperty(String name)
          Triggers the end of handling a property.
 TimeZoneRegistry getRegistry()
          Returns the timezone registry used in the construction of calendars.
 void parameter(String name, String value)
          Triggers the handling of a parameter.
 void propertyValue(String value)
          Triggers the handling of a property value.
 void startCalendar()
          Triggers the start of handling a calendar.
 void startComponent(String name)
          Triggers the start of handling a component.
 void startProperty(String name)
          Triggers the start of handling a property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

calendar

protected Calendar calendar

component

protected Component component

subComponent

protected Component subComponent

property

protected Property property
Constructor Detail

CalendarBuilder

public CalendarBuilder()
Default constructor.


CalendarBuilder

public CalendarBuilder(CalendarParser parser)
Constructs a new calendar builder using the specified calendar parser.

Parameters:
parser - a calendar parser used to parse calendar files

CalendarBuilder

public CalendarBuilder(TimeZoneRegistry registry)
Constructs a new calendar builder using the specified timezone registry.


CalendarBuilder

public CalendarBuilder(CalendarParser parser,
                       TimeZoneRegistry registry)
Constructs a new instance using the specified parser and registry.

Parameters:
parser - a calendar parser used to construct the calendar
registry - a timezone registry used to retrieve timezones and register additional timezone information found in the calendar
Method Detail

build

public Calendar build(InputStream in)
               throws IOException,
                      ParserException
Builds an iCalendar model from the specified input stream.

Parameters:
in -
Returns:
a calendar
Throws:
IOException
ParserException

build

public Calendar build(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 -
Returns:
a calendar
Throws:
IOException
ParserException

build

public Calendar build(UnfoldingReader uin)
               throws IOException,
                      ParserException
Build an iCalendar model by parsing data from the specified reader.

Parameters:
uin - an unfolding reader to read data from
Returns:
a calendar model
Throws:
IOException
ParserException

endCalendar

public void endCalendar()
Description copied from interface: ContentHandler
Triggers the end of handling a calendar.

Specified by:
endCalendar in interface ContentHandler

endComponent

public void endComponent(String name)
Description copied from interface: ContentHandler
Triggers the end of handling a component.

Specified by:
endComponent in interface ContentHandler

endProperty

public void endProperty(String name)
Description copied from interface: ContentHandler
Triggers the end of handling a property.

Specified by:
endProperty in interface ContentHandler

parameter

public void parameter(String name,
                      String value)
               throws URISyntaxException
Description copied from interface: ContentHandler
Triggers the handling of a parameter.

Specified by:
parameter in interface ContentHandler
Throws:
URISyntaxException

propertyValue

public void propertyValue(String value)
                   throws URISyntaxException,
                          ParseException,
                          IOException
Description copied from interface: ContentHandler
Triggers the handling of a property value.

Specified by:
propertyValue in interface ContentHandler
Throws:
URISyntaxException
ParseException
IOException

startCalendar

public void startCalendar()
Description copied from interface: ContentHandler
Triggers the start of handling a calendar.

Specified by:
startCalendar in interface ContentHandler

startComponent

public void startComponent(String name)
Description copied from interface: ContentHandler
Triggers the start of handling a component.

Specified by:
startComponent in interface ContentHandler

startProperty

public void startProperty(String name)
Description copied from interface: ContentHandler
Triggers the start of handling a property.

Specified by:
startProperty in interface ContentHandler

getRegistry

public final TimeZoneRegistry getRegistry()
Returns the timezone registry used in the construction of calendars.

Returns:
a timezone registry