Class CalendarTimezoneHelper


  • public class CalendarTimezoneHelper
    extends java.lang.Object
    This class provides helper functions for when working with Timezones for Calendar events. It provides support for generating iCal timezone information blocks, and building Java TimeZones based on iCal timezone information.
    Since:
    4.0
    Author:
    Nick Burch
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.SimpleTimeZone buildTimeZone​(java.lang.String ical)
      Builds a Java TimeZone from the VTIMEZONE info in an iCal file.
      protected static java.util.SimpleTimeZone buildTimeZone​(java.util.Map<java.lang.String,​java.lang.String> icalParams)
      Internal version that takes the parameters from getICalParams(String) and builds a TimeZone from it.
      protected static java.util.Map<java.lang.String,​java.lang.String> getICalParams​(java.lang.String icalText)
      Turns an iCal event into event + timezone parameters.
      protected static java.lang.String[] icalLineKeyValue​(java.lang.String icalLine)
      Splits an iCal line into key and value by the first unquoted colon.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CalendarTimezoneHelper

        public CalendarTimezoneHelper()
    • Method Detail

      • buildTimeZone

        public static java.util.SimpleTimeZone buildTimeZone​(java.lang.String ical)
        Builds a Java TimeZone from the VTIMEZONE info in an iCal file.
        Returns:
        a Java TimeZone that matches the iCal one, or NULL if no TZ info present
      • buildTimeZone

        protected static java.util.SimpleTimeZone buildTimeZone​(java.util.Map<java.lang.String,​java.lang.String> icalParams)
        Internal version that takes the parameters from getICalParams(String) and builds a TimeZone from it. This is not public as it will be refactored when getICalParams(String) is replaced. Note - because it uses the icalParams, we can't handle cases where we're given historic TZ info (eg until 2004 it was that, now it's this)
      • icalLineKeyValue

        protected static java.lang.String[] icalLineKeyValue​(java.lang.String icalLine)
        Splits an iCal line into key and value by the first unquoted colon.
        Parameters:
        icalLine - String
      • getICalParams

        protected static java.util.Map<java.lang.String,​java.lang.String> getICalParams​(java.lang.String icalText)
        Turns an iCal event into event + timezone parameters. This is very closely tied to the SPP / VTI implementation, and should be replaced with something more general. Until then, it is deliberately not public.
        Parameters:
        icalText - iCal text for the event, and the TZ (prefixed)