public class XCalReader extends StreamReader
Reads xCals (XML-encoded vCards) in a streaming fashion.
Example:
File file = new File("xcals.xml"); List<ICalendar> icals = new ArrayList<ICalendar>(); XCalReader xcalReader = new XCalReader(file); ICalendar ical; while ((ical = xcalReader.readNext()) != null) { icals.add(ical); }
Getting timezone information:
XCalReader reader = ... ICalendar ical = reader.readNext(); TimezoneInfo tzinfo = reader.getTimezoneInfo(); //get the VTIMEZONE components that were parsed //the VTIMEZONE components will NOT be in the ICalendar object Collection<VTimezone> vtimezones = tzinfo.getComponents(); //get the timezone that a property was originally formatted in DateStart dtstart = ical.getEvents().get(0).getDateStart(); TimeZone tz = tzinfo.getTimeZone(dtstart);
context, index, tzinfo, warnings
Constructor and Description |
---|
XCalReader(File file)
Creates an xCal reader.
|
XCalReader(InputStream in)
Creates an xCal reader.
|
XCalReader(Node node)
Creates an xCal reader.
|
XCalReader(Reader reader)
Creates an xCal reader.
|
XCalReader(String str)
Creates an xCal reader.
|
Modifier and Type | Method and Description |
---|---|
protected ICalendar |
_readNext()
Reads the next iCalendar object from the data stream.
|
void |
close()
Closes the underlying input stream.
|
getScribeIndex, getTimezoneInfo, getWarnings, readAll, readNext, registerScribe, registerScribe, setScribeIndex
public XCalReader(String str)
str
- the string to read the xCals frompublic XCalReader(InputStream in)
in
- the input stream to read the xCals frompublic XCalReader(File file) throws FileNotFoundException
file
- the file to read the xCals fromFileNotFoundException
- if the file doesn't existpublic XCalReader(Reader reader)
reader
- the reader to read frompublic XCalReader(Node node)
node
- the DOM node to read fromprotected ICalendar _readNext() throws IOException
StreamReader
_readNext
in class StreamReader
IOException
- if there's a problem reading from the streampublic void close() throws IOException
IOException
Copyright © 2013-2015 Michael Angstadt. All Rights Reserved.