/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.opentransport.rdfmapper.nmbs;

import java.net.URL;

import com.google.transit.realtime.GtfsRealtime.FeedEntity;
import com.google.transit.realtime.GtfsRealtime.FeedMessage;

/**
 *
 * @author timtijssens
 */
public class GtfsRealtimeExample {
    
    public GtfsRealtimeExample(String filename) throws Exception {
        System.out.println("Testing Real Time Example");
        URL url = new URL("http://localhost:8000/" +filename);
        FeedMessage feed = FeedMessage.parseFrom(url.openStream());
        for (FeedEntity entity : feed.getEntityList()) {
          if (entity.hasTripUpdate()) {
            System.out.println(entity.getTripUpdate());
          }
            if (entity.hasAlert()) {
                System.out.println(entity.getAlert());

            }
        }
      }
    
}

@@ -363,16 +363,142 @@
 Message;
+%0Aimport java.io.FileInputStream;%0Aimport java.io.FileNotFoundException;%0Aimport java.io.IOException;%0Aimport java.io.InputStream;
 %0A%0A/**%0A *
@@ -701,52 +701,85 @@
     
-URL url = new URL(%22http://localhost:8000/%22 +
+%0A        InputStream is;%0A%0A        try %7B%0A            is = new FileInputStream(
 file
@@ -785,16 +785,20 @@
 ename);%0A
+    
         
@@ -842,27 +842,18 @@
 rom(
-url.openStream());%0A
+is);%0A%0A    
     
@@ -907,32 +907,36 @@
 ()) %7B%0A          
+ 
+   
 if (entity.hasTr
@@ -945,24 +945,28 @@
 Update()) %7B%0A
+    
             
@@ -1009,16 +1009,20 @@
 ate());%0A
+    
         
@@ -1029,32 +1029,36 @@
   %7D%0A            
+    
 if (entity.hasAl
@@ -1062,24 +1062,28 @@
 sAlert()) %7B%0A
+    
             
@@ -1129,22 +1129,208 @@
 ));%0A
-%0A            %7D
+                %7D%0A            %7D%0A            is.close(); %0A        %7D catch (FileNotFoundException e) %7B%0A            e.printStackTrace();%0A        %7D catch (IOException e) %7B%0A            e.printStackTrace();
 %0A   
@@ -1339,20 +1339,19 @@
    %7D%0A      %7D
-%0A
     %0A%7D%0A

Test your fresh generated trip_updates.pb and service_alerts.pb locally