コード例 #1
0
ファイル: CalendarUtils.java プロジェクト: CooSocial/cosmo
 /**
  * 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);
 }
コード例 #2
0
ファイル: CalendarUtils.java プロジェクト: CooSocial/cosmo
  /**
   * 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);
  }
コード例 #3
0
ファイル: CalendarUtils.java プロジェクト: CooSocial/cosmo
 /**
  * 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);
 }
コード例 #4
0
ファイル: CalendarUtils.java プロジェクト: CooSocial/cosmo
 /**
  * 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));
 }