public class JCalReader extends StreamReader
Parses ICalendar
objects from a jCal data stream (JSON).
Example:
InputStream in = ... JCalReader jcalReader = new JCalReader(in); ICalendar ical; while ((ical = jcalReader.readNext()) != null){ ... } jcalReader.close();
Getting timezone information:
JCalReader 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 |
---|
JCalReader(File file)
Creates a jCard reader.
|
JCalReader(InputStream in)
Creates a jCard reader.
|
JCalReader(Reader reader)
Creates a jCard reader.
|
JCalReader(String json)
Creates a jCard reader.
|
Modifier and Type | Method and Description |
---|---|
ICalendar |
_readNext()
Reads the next iCalendar object from the JSON data stream.
|
void |
close() |
getScribeIndex, getTimezoneInfo, getWarnings, readAll, readNext, registerScribe, registerScribe, setScribeIndex
public JCalReader(String json)
json
- the JSON stringpublic JCalReader(InputStream in)
in
- the input stream to read the vCards frompublic JCalReader(File file) throws FileNotFoundException
file
- the file to read the vCards fromFileNotFoundException
- if the file doesn't existpublic JCalReader(Reader reader)
reader
- the reader to read the vCards frompublic ICalendar _readNext() throws IOException
_readNext
in class StreamReader
JCalParseException
- if the jCal syntax is incorrect (the JSON
syntax may be valid, but it is not in the correct jCal format).JsonParseException
- if the JSON syntax is incorrectIOException
- if there is a problem reading from the data streampublic void close() throws IOException
IOException
Copyright © 2013-2015 Michael Angstadt. All Rights Reserved.