public class ICalReader extends StreamReader
Parses ICalendar
objects from an iCalendar data stream.
Example:
InputStream in = ... ICalReader icalReader = new ICalReader(in); ICalendar ical; while ((ical = icalReader.readNext()) != null){ ... } icalReader.close();
Getting timezone information:
ICalReader 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 |
---|
ICalReader(File file)
Creates a reader that parses iCalendar objects from a file.
|
ICalReader(InputStream in)
Creates a reader that parses iCalendar objects from an input stream.
|
ICalReader(Reader reader)
Creates a reader that parses iCalendar objects from a reader.
|
ICalReader(String string)
Creates a reader that parses iCalendar objects from a string.
|
Modifier and Type | Method and Description |
---|---|
protected ICalendar |
_readNext()
Reads the next iCalendar object from the data stream.
|
void |
close()
Closes the underlying
Reader object. |
Charset |
getDefaultQuotedPrintableCharset()
Gets the character set to use when decoding quoted-printable values if
the property has no CHARSET parameter, or if the CHARSET parameter is not
a valid character set.
|
boolean |
isCaretDecodingEnabled()
Gets whether the reader will decode parameter values that use circumflex
accent encoding (enabled by default).
|
void |
setCaretDecodingEnabled(boolean enable)
Sets whether the reader will decode parameter values that use circumflex
accent encoding (enabled by default).
|
void |
setDefaultQuotedPrintableCharset(Charset charset)
Sets the character set to use when decoding quoted-printable values if
the property has no CHARSET parameter, or if the CHARSET parameter is not
a valid character set.
|
getScribeIndex, getTimezoneInfo, getWarnings, readAll, readNext, registerScribe, registerScribe, setScribeIndex
public ICalReader(String string)
string
- the stringpublic ICalReader(InputStream in)
in
- the input streampublic ICalReader(File file) throws FileNotFoundException
file
- the fileFileNotFoundException
- if the file doesn't existpublic ICalReader(Reader reader)
reader
- the readerpublic boolean isCaretDecodingEnabled()
ICalRawReader.isCaretDecodingEnabled()
public void setCaretDecodingEnabled(boolean enable)
enable
- true to use circumflex accent decoding, false not toICalRawReader.setCaretDecodingEnabled(boolean)
public Charset getDefaultQuotedPrintableCharset()
Gets the character set to use when decoding quoted-printable values if the property has no CHARSET parameter, or if the CHARSET parameter is not a valid character set.
By default, the Reader's character encoding will be used. If the Reader has no character encoding, then the system's default character encoding will be used.
public void setDefaultQuotedPrintableCharset(Charset charset)
Sets the character set to use when decoding quoted-printable values if the property has no CHARSET parameter, or if the CHARSET parameter is not a valid character set.
By default, the Reader's character encoding will be used. If the Reader has no character encoding, then the system's default character encoding will be used.
charset
- the character setprotected ICalendar _readNext() throws IOException
StreamReader
_readNext
in class StreamReader
IOException
- if there's a problem reading from the streampublic void close() throws IOException
Reader
object.IOException
Copyright © 2013-2015 Michael Angstadt. All Rights Reserved.