2 * Copyright © 2015 Keith Packard <keithp@keithp.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
18 package org.altusmetrum.altoslib_8;
23 import java.util.concurrent.*;
27 public class AltosLaunchSites extends Thread {
29 LinkedList<AltosLaunchSite> sites;
30 AltosLaunchSiteListener listener;
32 void notify_complete() {
33 listener.notify_launch_sites(sites);
36 void add(AltosLaunchSite site) {
40 void add(String line) {
42 add(new AltosLaunchSite(line));
43 } catch (ParseException pe) {
44 System.out.printf("parse exception %s\n", pe.toString());
50 url = new URL(AltosLib.launch_sites_url);
51 URLConnection uc = url.openConnection();
53 InputStreamReader in_stream = new InputStreamReader(uc.getInputStream(), AltosLib.unicode_set);
54 BufferedReader in = new BufferedReader(in_stream);
57 String line = in.readLine();
62 } catch (Exception e) {
68 public AltosLaunchSites(AltosLaunchSiteListener listener) {
69 sites = new LinkedList<AltosLaunchSite>();
70 this.listener = listener;