Ejemplo n.º 1
0
 /**
  * Parse icalendar data from Reader into Calendar object.
  *
  * @param reader icalendar data reader
  * @return Calendar object
  * @throws ParserException - if something is wrong this exception is thrown.
  * @throws IOException - if something is wrong this exception is thrown.
  */
 public static Calendar parseCalendar(Reader reader) throws ParserException, IOException {
   if (reader == null) {
     return null;
   }
   CalendarBuilder builder = CalendarBuilderDispenser.getCalendarBuilder();
   clearTZRegistry(builder);
   return builder.build(reader);
 }
Ejemplo n.º 2
0
  /**
   * Parse icalendar string into Calendar object.
   *
   * @param calendar icalendar string
   * @return Calendar object
   * @throws ParserException - if something is wrong this exception is thrown.
   * @throws IOException - if something is wrong this exception is thrown.
   */
  public static Calendar parseCalendar(String calendar) throws ParserException, IOException {
    if (calendar == null) {
      return null;
    }
    CalendarBuilder builder = CalendarBuilderDispenser.getCalendarBuilder();
    clearTZRegistry(builder);

    StringReader sr = new StringReader(calendar);
    return builder.build(sr);
  }
Ejemplo n.º 3
0
 /**
  * Parse icalendar data from InputStream
  *
  * @param is icalendar data inputstream
  * @return Calendar object
  * @throws ParserException - if something is wrong this exception is thrown.
  * @throws IOException - if something is wrong this exception is thrown.
  */
 public static Calendar parseCalendar(InputStream is) throws ParserException, IOException {
   CalendarBuilder builder = CalendarBuilderDispenser.getCalendarBuilder();
   clearTZRegistry(builder);
   return builder.build(is);
 }
Ejemplo n.º 4
0
 /**
  * Parse icalendar data from byte[] into Calendar object.
  *
  * @param content icalendar data
  * @return Calendar object
  * @throws ParserException - if something is wrong this exception is thrown.
  * @throws IOException - if something is wrong this exception is thrown.
  */
 public static Calendar parseCalendar(byte[] content) throws ParserException, IOException {
   CalendarBuilder builder = CalendarBuilderDispenser.getCalendarBuilder();
   clearTZRegistry(builder);
   return builder.build(new ByteArrayInputStream(content));
 }