public class XCalReader extends Object implements Closeable
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);
}
| 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 |
|---|---|
void |
close()
Closes the underlying input stream.
|
ScribeIndex |
getScribeIndex()
Gets the scribe index.
|
List<String> |
getWarnings()
Gets the warnings from the last iCalendar object that was unmarshalled.
|
ICalendar |
readNext()
Reads the next iCalendar object from the xCal stream.
|
void |
registerScribe(ICalComponentScribe<? extends ICalComponent> scribe)
Registers a component scribe.
|
void |
registerScribe(ICalPropertyScribe<? extends ICalProperty> scribe)
Registers a property scribe.
|
void |
setScribeIndex(ScribeIndex index)
Sets the scribe index.
|
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 frompublic void registerScribe(ICalComponentScribe<? extends ICalComponent> scribe)
Registers a component scribe. This is the same as calling:
getScribeIndex().register(scribe)
scribe - the scribe to registerpublic void registerScribe(ICalPropertyScribe<? extends ICalProperty> scribe)
Registers a property scribe. This is the same as calling:
getScribeIndex().register(scribe)
scribe - the scribe to registerpublic ScribeIndex getScribeIndex()
public void setScribeIndex(ScribeIndex index)
index - the scribe indexpublic List<String> getWarnings()
public ICalendar readNext() throws TransformerException
TransformerException - if there's a problem reading from the streampublic void close() throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionCopyright © 2013-2014 Michael Angstadt. All Rights Reserved.