public class ICalReader extends StreamReader
Parses ICalendar objects from a plain-text iCalendar data stream.
Example:
File file = new File("icals.ics");
ICalReader reader = null;
try {
reader = new ICalReader(file);
ICalendar ical;
while ((ical = reader.readNext()) != null){
...
}
} finally {
if (reader != null) reader.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) |
ICalReader(InputStream in) |
ICalReader(Reader reader) |
ICalReader(String str) |
| 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, setScribeIndexpublic ICalReader(String str)
str - the string to read frompublic ICalReader(InputStream in)
in - the input stream to read frompublic ICalReader(File file) throws FileNotFoundException
file - the file to read fromFileNotFoundException - if the file doesn't existpublic ICalReader(Reader reader)
reader - the reader to read frompublic 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 StreamReaderIOException - if there's a problem reading from the streampublic void close() throws IOException
Reader object.IOExceptionCopyright © 2013-2015 Michael Angstadt. All Rights Reserved.