public class JCalReader extends Object implements Closeable
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();
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 |
---|---|
void |
close() |
ScribeIndex |
getScribeIndex()
Gets the object that manages the component/property scribes.
|
List<String> |
getWarnings()
Gets the warnings from the last iCalendar object that was unmarshalled.
|
ICalendar |
readNext()
Reads the next iCalendar object from the JSON data stream.
|
void |
registerScribe(ICalComponentScribe<? extends ICalComponent> scribe)
Registers an experimental component scribe.
|
void |
registerScribe(ICalPropertyScribe<? extends ICalProperty> scribe)
Registers an experimental property scribe.
|
void |
setScribeIndex(ScribeIndex index)
Sets the object that manages the component/property scribes.
|
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 List<String> getWarnings()
public void registerScribe(ICalPropertyScribe<? extends ICalProperty> scribe)
Registers an experimental property scribe. Can also be used to override the scribe of a standard property (such as DTSTART). Calling this method is the same as calling:
getScribeIndex().register(scribe)
.
scribe
- the scribe to registerpublic void registerScribe(ICalComponentScribe<? extends ICalComponent> scribe)
Registers an experimental component scribe. Can also be used to override the scribe of a standard component (such as VEVENT). Calling this method is the same as calling:
getScribeIndex().register(scribe)
.
scribe
- the scribe to registerpublic ScribeIndex getScribeIndex()
public void setScribeIndex(ScribeIndex index)
index
- the scribe indexpublic ICalendar readNext() throws IOException
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
close
in interface Closeable
close
in interface AutoCloseable
IOException
Copyright © 2013-2014 Michael Angstadt. All Rights Reserved.