public void setData(byte[] data) throws IOException, ParserException { CalendarBuilder builder = new CalendarBuilder(); calendar = builder.build(new ByteArrayInputStream(data)); this.data = data.clone(); }
/** * Builds an iCalendar model from the specified reader. An <code>UnfoldingReader</code> is applied to the * specified reader to ensure the data stream is correctly unfolded where appropriate. * * @param in a reader to read calendar data from * @return a calendar parsed from the specified reader * @throws IOException where an error occurs reading data from the specified reader * @throws ParserException where an error occurs parsing data from the reader */ public Calendar build(final Reader in) throws IOException, ParserException { return build(new UnfoldingReader(in)); }
public DefaultContentHandler(Consumer<Calendar> consumer, TimeZoneRegistry tzRegistry) { this(consumer, tzRegistry, new DefaultParameterFactorySupplier(), new DefaultPropertyFactorySupplier(), new DefaultComponentFactorySupplier()); }
/** * {@inheritDoc} */ public final void write(final int c) throws IOException { /* * super.write(c); if (c == '\n') { lineLength = 0; } else { lineLength += 1; } if (lineLength >= FOLD_LENGTH) { * super.write(FOLD_PATTERN); } */ write(new char[]{(char) c}, 0, 1); }
/** * {@inheritDoc} */ public CalendarParser get() { return new HCalendarParser(); }
/** * Constructs a new calendar builder using the specified timezone registry. * * @param tzRegistry a timezone registry to populate with discovered timezones */ public CalendarBuilder(final TimeZoneRegistry tzRegistry) { this.parser = CalendarParserFactory.getInstance().get(); this.tzRegistry = tzRegistry; this.contentHandler = new DefaultContentHandler(this, tzRegistry); }
/** * Test method for {@link CalendarParserFactory#get()}. */ public void testCreateDefaultParser() { assertTrue(CalendarParserFactory.getInstance().get() instanceof CalendarParserImpl); }
/** * Build an iCalendar model by parsing data from the specified reader. * * @param uin an unfolding reader to read data from * @return a calendar parsed from the specified reader * @throws IOException where an error occurs reading data from the specified reader * @throws ParserException where an error occurs parsing data from the reader */ public Calendar build(final UnfoldingReader uin) throws IOException, ParserException { parser.parse(uin, contentHandler); return calendar; }
/** * * @param tokeniser * @param in * @return int value of the ttype field of the tokeniser * @throws IOException * @throws ParserException */ private int nextToken(StreamTokenizer tokeniser, Reader in) throws IOException, ParserException { return nextToken(tokeniser, in, false); }
private static Element findElement(XPathExpression expr, Object context) throws ParserException { Node n = findNode(expr, context); if ((!(n instanceof Element))) return null; return (Element) n; }
/** * {@inheritDoc} */ public CalendarParser createParser() { return new CalendarParserImpl(); } }
/** * Builds an iCalendar model from the specified reader. An <code>UnfoldingReader</code> is applied to the * specified reader to ensure the data stream is correctly unfolded where appropriate. * * @param in a reader to read calendar data from * @return a calendar parsed from the specified reader * @throws IOException where an error occurs reading data from the specified reader * @throws ParserException where an error occurs parsing data from the reader */ public Calendar build(final Reader in) throws IOException, ParserException { return build(new UnfoldingReader(in)); }
/** * {@inheritDoc} */ public final void write(final int c) throws IOException { /* * super.write(c); if (c == '\n') { lineLength = 0; } else { lineLength += 1; } if (lineLength >= FOLD_LENGTH) { * super.write(FOLD_PATTERN); } */ write(new char[]{(char) c}, 0, 1); }
/** * {@inheritDoc} */ public CalendarParser get() { return new HCalendarParser(); }
public DefaultContentHandler(Consumer<Calendar> consumer, TimeZoneRegistry tzRegistry) { this(consumer, tzRegistry, new DefaultParameterFactorySupplier(), new DefaultPropertyFactorySupplier(), new DefaultComponentFactorySupplier()); }
/** * * @param tokeniser * @param in * @return int value of the ttype field of the tokeniser * @throws IOException * @throws ParserException */ private int nextToken(StreamTokenizer tokeniser, Reader in) throws IOException, ParserException { return nextToken(tokeniser, in, false); }
/** * Builds an iCalendar model from the specified reader. An <code>UnfoldingReader</code> is applied to the * specified reader to ensure the data stream is correctly unfolded where appropriate. * @param in a reader to read calendar data from * @return a calendar parsed from the specified reader * @throws IOException where an error occurs reading data from the specified reader * @throws ParserException where an error occurs parsing data from the reader */ public Calendar build(final Reader in) throws IOException, ParserException { return build(new UnfoldingReader(in)); }
/** * {@inheritDoc} */ public CalendarParser createParser() { return new HCalendarParser(); }
/** * Builds an iCalendar model from the specified reader. An <code>UnfoldingReader</code> is applied to the * specified reader to ensure the data stream is correctly unfolded where appropriate. * * @param in a reader to read calendar data from * @return a calendar parsed from the specified reader * @throws IOException where an error occurs reading data from the specified reader * @throws ParserException where an error occurs parsing data from the reader */ public Calendar build(final Reader in) throws IOException, ParserException { return build(new UnfoldingReader(in)); }
/** * Builds an iCalendar model from the specified reader. An <code>UnfoldingReader</code> is applied to the * specified reader to ensure the data stream is correctly unfolded where appropriate. * * @param in a reader to read calendar data from * @return a calendar parsed from the specified reader * @throws IOException where an error occurs reading data from the specified reader * @throws ParserException where an error occurs parsing data from the reader */ public Calendar build(final Reader in) throws IOException, ParserException { return build(new UnfoldingReader(in)); }