Package org.onebusaway.gtfs.serialization

Examples of org.onebusaway.gtfs.serialization.GtfsReader


    List<GtfsBundle> bundles = UtilityLibrary.getGtfsBundlesForArguments(paths);

    for (GtfsBundle bundle : bundles) {

      GtfsReader reader = new GtfsReader();
      reader.setDefaultAgencyId(bundle.getDefaultAgencyId());
      reader.setInputLocation(bundle.getPath());
      for (Map.Entry<String, String> entry : bundle.getAgencyIdMappings().entrySet())
        reader.addAgencyIdMapping(entry.getKey(), entry.getValue());
      reader.getEntityClasses().retainAll(
          Arrays.asList(Agency.class, Stop.class));
      reader.addEntityHandler(handler);
      reader.run();
    }

    Set<AgencyAndId> ids = handler.getIds();

    InputStream in = IOLibrary.getPathAsInputStream(args[0]);
    BufferedReader reader = new BufferedReader(new InputStreamReader(in));

    String line = null;

    while ((line = reader.readLine()) != null) {
      if (line.startsWith("#") || line.startsWith("{{{")
          || line.startsWith("}}}") || line.length() == 0)
        continue;
      String[] tokens = line.split("\\s+");
      AgencyAndId id = AgencyAndIdLibrary.convertFromString(tokens[0]);
View Full Code Here

TOP

Related Classes of org.onebusaway.gtfs.serialization.GtfsReader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.