4

Currently I am using 2 tools to start processing an iCal calendar from URL. First, using Google Chrome I create a .ics file from the calendar URL (for example I can get URL from AirBnb) and then I use ical4j to process the created file. Is there any way to use this URL directly in the Java program?

Alex
  • 7,007
  • 18
  • 69
  • 114
  • You mean you have the URL, manually download the ics file using google chrome and then process the calendar file using ical4j. Is it? – Andrews Jul 21 '17 at 06:01

1 Answers1

3

Probably something like:

InputStream is = new URL("http://airbnb.com/ical/").openStream();
try {
   Calendar cal = new CalendarBuilder().build(is);
} finally {
  is.close();
}
Niels Bech Nielsen
  • 4,777
  • 1
  • 21
  • 44
  • Or even from Java 7 `try (InputStream is = new URL("http://airbnb.com/ical/").openStream()) { Calendar cal = new CalendarBuilder().build(is); }` – pba Dec 10 '20 at 16:38