-
Notifications
You must be signed in to change notification settings - Fork 5
/
README.html
89 lines (67 loc) · 3.05 KB
/
README.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<!DOCTYPE PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Read Me</title>
<link type="text/css" rel="stylesheet"
href="http://google-code-prettify.googlecode.com/svn/trunk/src/prettify.css" />
<script type="text/javascript"
src="http://google-code-prettify.googlecode.com/svn/trunk/src/prettify.js"
></script>
</head>
<body onload="prettyPrint()" bgcolor="white">
<h2>Online Documentation</h2>
<p>The javadoc is available <a
href="http://google-rfc-2445.googlecode.com/svn/trunk/snapshot/docs/index.html"
>online</a>.</p>
<h2>Downloading</h2>
<p>The source is available from subversion. See <a
href="http://code.google.com/p/google-rfc-2445/source">the project page</a> for
instructions on how to download the source from subversion.</p>
<h2>Building</h2>
<p>Requires <a href="http://ant.apache.org/">ant</a> to build with
<a href="http://www.junit.org/">junit</a> for testing, and optionally
<a href="http://joda-time.sourceforge.net/">joda-time</a> installed.</p>
<p>Once you've got <code>ant</code>
<a href="http://ant.apache.org/manual/index.html">set up and installed</a>,
run <code>ant default</code> to build the jars and documentation, and then
read the documentation in the <code>docs</code> directory. You can use the jar
at <code>jars/rfc2445.jar</code> in your program.</p>
<p>To build without joda-time, run <code>ant rfc2445-no-joda</code> and it will
produce a version of the jar without the joda-time compatibility classes.</p>
<h2>Using</h2>
<p>Using the API is pretty easy. Pass in some ical and you get back
a date iterable, which can be used in a for-each loop thusly:</p>
<pre class=prettyprint>
// A compatibility layer for joda-time
import com.google.ical.compat.jodatime.LocalDateIteratorFactory;
// A Joda time class that represents a day regardless of timezone
import org.joda.time.LocalDate;
public class ThirteenFridaysTheThirteenth {
/** print the first 13 Friday the 13ths in the 3rd millenium AD. */
public static void main(String[] args) throws java.text.ParseException {
LocalDate start = new LocalDate(2001, 4, 13);
// Every friday the thirteenth.
String ical = "RRULE:FREQ=MONTHLY"
+ ";BYDAY=FR" // every Friday
+ ";BYMONTHDAY=13" // that occurs on the 13th of the month
+ ";COUNT=13"; // stop after 13 occurences
// Print out each date in the series.
for (LocalDate date :
LocalDateIteratorFactory.createLocalDateIterable(ical, start, true)) {
System.out.println(date);
}
}
}
</pre>
<p>See <a href="rfc2445.html#4.3.10">RFC 2445</a> for the recurrence rule
syntax and what it means, and the examples <a href="rfc2445.html#4.8.5.4"
>later</a> in the same document.</p>
<p>If you use <code>java.util.Date</code> and <code>java.util.Calendar</code> in
your application instead of Joda-Time, you can use the
<code>com.google.ical.compat.javautil</code> package instead to provide
Date objects.</p>
<h2>Running tests</h2>
<p>If you make source changes, you can run <code>ant runtests</code> to run
build and run the tests.</p>
</body>
</html>