public class JCalReader extends StreamReader
Parses ICalendar objects from a jCal data stream (JSON).
Example:
File file = new File("icals.json");
JCalReader reader = null;
try {
reader = new JCalReader(file);
ICalendar ical;
while ((ical = reader.readNext()) != null){
...
}
} finally {
if (reader != null) reader.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) |
JCalReader(InputStream in) |
JCalReader(Reader reader) |
JCalReader(String json) |
| 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, setScribeIndexpublic JCalReader(String json)
json - the JSON string to read frompublic JCalReader(InputStream in)
in - the input stream to read frompublic JCalReader(File file) throws FileNotFoundException
file - the file to read fromFileNotFoundException - if the file doesn't existpublic JCalReader(Reader reader)
reader - the reader to read frompublic ICalendar _readNext() throws IOException
_readNext in class StreamReaderJCalParseException - 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
IOExceptionCopyright © 2013-2015 Michael Angstadt. All Rights Reserved.