public class XCalReader extends StreamReader
Reads xCals (XML-encoded iCalendar objects) in a streaming fashion.
Example:
File file = new File("icals.xml");
XCalReader reader = null;
try {
reader = new XCalReader(file);
ICalendar ical;
while ((ical = reader.readNext()) != null){
...
}
} finally {
if (reader != null) reader.close();
}
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) |
XCalReader(InputStream in) |
XCalReader(Node node) |
XCalReader(Reader reader) |
XCalReader(String str) |
| 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, setScribeIndexpublic XCalReader(String str)
str - the string to read frompublic XCalReader(InputStream in)
in - the input stream to read frompublic XCalReader(File file) throws FileNotFoundException
file - the file to read 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 StreamReaderIOException - if there's a problem reading from the streampublic void close() throws IOException
IOExceptionCopyright © 2013-2015 Michael Angstadt. All Rights Reserved.