Class ICalBuilder.Base

java.lang.Object
org.bzdev.net.calendar.ICalBuilder.Base
Direct Known Subclasses:
ICalBuilder.Alarm, ICalBuilder.Common, ICalBuilder.Component
Enclosing class:
ICalBuilder

public abstract static class ICalBuilder.Base extends Object
Base class for iCalendar components.
  • Field Details

    • contentLines

      protected LinkedList<String> contentLines
      Lines of text created for the iCalendar format, but without the EOL sequence and/or line folding. Subclasses will use this field to record the lines they create.
  • Constructor Details

    • Base

      protected Base()
      Constructor.
  • Method Details

    • setDuration

      public void setDuration(int duration, ICalBuilder.Units units) throws UnsupportedOperationException
      Set the duration for an iCalendar component. Durations are define in Section 3.8.2.5 of RFC 5545 Some iCalendar components do not have a 'duration' property, and the subclasses for those components will throw an exception if this method is called (this behavior should be documented by all subclasses that do not support this method).
      Parameters:
      duration - the duration, either a positive integer or 0 if the duration should be ignored
      units - the units for the duration (ICalBuilder.Units.SECONDS, ICalBuilder.Units.MINUTES, ICalBuilder.Units.HOURS, ICalBuilder.Units.DAYS, or ICalBuilder.Units.WEEKS); null only if the duration is 0
      Throws:
      UnsupportedOperationException - if an iCalendar component does not have a duration.
      IllegalArgumentException - an argument had an illegal value
    • addAttachment

      public void addAttachment(String formatType, String uri) throws UnsupportedOperationException
      Add an attachment referenced by a URI. Attachments are defined in Section 3.8.1.1 of RFC 5545. The media type is defined in Section 4.2 of RFC 4288. Some iCalendar components do not have an 'attachment' property, and the subclasses for those components will throw an exception if this method is called (this behavior should be documented by all subclasses that do not support this method).
      Parameters:
      formatType - the media type of an attachment
      uri - the URI referencing the attachment
      Throws:
      UnsupportedOperationException - a subclass does not allow attachments
    • addAttachment

      public void addAttachment(String formatType, byte[] data) throws UnsupportedOperationException
      Add an attachment provided as binary data. The media type is defined in Section 4.2 of RFC 4288. Attachments are defined in Section 3.8.1.1 of RFC 5545. Some iCalendar components do not have an 'attachment' property, and the subclasses for those components will throw an exception if this method is called (this behavior should be documented by all subclasses that do not support this method).
      Parameters:
      formatType - the media type of an attachment
      data - an array of bytes containing the attachment
      Throws:
      UnsupportedOperationException - a subclass does not allow attachments
    • addProperty

      public void addProperty(String property, boolean escapeValues, String... values)
      Add a property with no parameters to this iCalendar component. RFC 5544 provides a sizable number of properties, and allows experimental ones to be added. This method allows a property to be explicitly added.

      If the values are URIs, the third argument (escapeValues) should be set to false; for text, it should be set to true. The property name must be one allowed by RFC 5545 for the current iCalendar component. None of the arguments should be folded.

      As a general rule, the caller of this method should set the 'escapeValues' argument so that the user can provide values that have not been escaped: typically only text values need to be escaped.

      Parameters:
      property - the name of the property
      escapeValues - true if the the values should be escaped by this method; false otherwise
      values - one or more values for the property
    • addProperty

      public void addProperty(String property, String param, boolean escapeValues, String... values)
      Add a property with a single parameter to this iCalendar component. RFC 5544 provides a sizable number of properties, and allows experimental ones to be added. This method allows any property to be explicitly added.

      If the values are URIs, the third argument (escapeValues) should be set to false; for text, it should be set to true. The property name must be one allowed by RFC 5545 for the current iCalendar component. A parameter should not be escaped, and none of the arguments should be folded.

      As a general rule, the caller of this method should set the 'escapeValues' argument so that the user can provide values that have not been escaped: typically only text values need to be escaped.

      Parameters:
      property - the name of the property
      param - the property's parameter; an empty string if there are no parameters
      escapeValues - true if the the values should be escaped by this method; false otherwise
      values - one or more values for the property
    • addProperty

      public void addProperty(String property, String[] params, boolean escapeValues, String... values)
      Add a property with multiple parameters to this iCalendar component. RFC 5544 provides a sizable number of properties, and allows experimental ones to be added. This method allows any property to be explicitly added.

      If the values are URIs, the third argument (escapeValues) should be set to false; for text, it should be set to true. The property name must be one allowed by RFC 5545 for the current iCalendar component. A parameter should not be escaped, and none of the arguments should be folded.

      As a general rule, the caller of this method should set the 'escapeValues' argument so that the user can provide values that have not been escaped: typically only text values need to be escaped.

      Parameters:
      property - the name of the property
      params - the property's parameters; a zero-length array indicates that there are no parameters.
      escapeValues - true if the the values should be escaped by this method; false otherwise
      values - one or more values for the property
    • createContentLines

      protected void createContentLines()
      Generate content lines. Subclasses that override this method should call super.createContentLines().
    • clearContentLines

      protected void clearContentLines()
      Clear the content lines. Subclasses that override this method must call super.clearContentLines().