Class ICalParser

java.lang.Object
org.bzdev.net.calendar.ICalParser
All Implemented Interfaces:
ICalComponent

public class ICalParser extends Object implements ICalComponent
Parser for iCalendar objects. An iCalendar parser in this implementation is also an implementation of the interface ICalComponent because this class represents an iCalendar's component (a VCALENDAR) has properties associated with it and contains other iCalendar components. Aside from the constructors, there are no public methods other than those defined by ICalComponent.

The documentation for ICalComponent describes the parse tree created when this method's constructor is called.

  • Constructor Details

    • ICalParser

      public ICalParser(byte[] data) throws IOException
      Constructor. The byte array contains UTF-8 encoded text with CRLF end of lines as described in RFC 5545.
      Parameters:
      data - the byte array containing an iCalendar
      Throws:
      IOException - an IO error occurred
    • ICalParser

      public ICalParser(byte[] data, String[] names) throws IOException
      Constructor adding text-property names. The byte array contains UTF-8 encoded text with CRLF end of lines as described in RFC 5545.

      The second argument is a list of the names of additional properties (these must not be ones explicitly defined in RFC 5545) whose values are text. RFC 5545 treats text differently from other property values. In particular, a ',' or ';' can values for fields containing multiple values, with a ',' or ';' escaped to denote text.

      Parameters:
      data - the byte array containing an iCalendar
      names - a list of additional property names whose values are text fields
      Throws:
      IOException - an IO error occurred
    • ICalParser

      public ICalParser(File f) throws IOException
      Constructor given a file. The file contains UTF-8 encoded text with CRLF end of lines as described in RFC 5545.
      Parameters:
      f - the file to read
      Throws:
      IOException - an error occurred while reading the input
    • ICalParser

      public ICalParser(InputStream is) throws IOException
      Constructor given an input stream. The input stream contains UTF-8 encoded text with CRLF end of lines as described in
      Parameters:
      is - the input stream to read
      Throws:
      IOException - an error occurred while reading the input
    • ICalParser

      public ICalParser(File f, String[] names) throws IOException
      Constructor given a file and adding text-property names. The file contains UTF-8 encoded text with CRLF end of lines as described in

      The second argument is a list of the names of additional properties (these must not be ones explicitly defined in RFC 5545) whose values are text. RFC 5545 treats text differently from other property values. In particular, a ',' or ';' can values for fields containing multiple values, with a ',' or ';' escaped to denote text.

      Parameters:
      f - the file to read
      names - a list of additional property names whose values are text fields
      Throws:
      IOException - an error occurred while reading the input
    • ICalParser

      public ICalParser(InputStream is, String[] names) throws IOException
      Constructor given and input stream and adding text-property names. The input stream contains UTF-8 encoded text with CRLF end of lines as described in

      The second argument is a list of the names of additional properties (these must not be ones explicitly defined in RFC 5545) whose values are text. RFC 5545 treats text differently from other property values. In particular, a ',' or ';' can values for fields containing multiple values, with a ',' or ';' escaped to denote text.

      Parameters:
      is - the input stream to read
      names - a list of additional property names whose values are text fields
      Throws:
      IOException - an error occurred while reading the input
  • Method Details

    • getName

      public String getName()
      Description copied from interface: ICalComponent
      Get the name of an iCalendar component. the name "VCALENDAR" is the name of the top-level component. Other component names defined by RFC 5545 are "VEVENT", "VTODO", "VJOURNAL", and "VALARM".
      Specified by:
      getName in interface ICalComponent
      Returns:
      the name
    • getComponents

      public List<ICalComponent> getComponents()
      Description copied from interface: ICalComponent
      Get the components nested within this component. Suitable components defined in RFC 5545 consist of alarms.
      Specified by:
      getComponents in interface ICalComponent
      Returns:
      a list of the nested components
    • getProperties

      public List<ICalProperty> getProperties()
      Description copied from interface: ICalComponent
      Get the properties for an iCalendar component.
      Specified by:
      getProperties in interface ICalComponent
      Returns:
      the component's properties