persolijn

an efficient router for busses
Log | Files | Refs

StringTable.java (652B)


      1 package osm.message;
      2 
      3 import java.util.ArrayList;
      4 import java.util.Iterator;
      5 import java.util.List;
      6 
      7 import protobuf.Message;
      8 import protobuf.ProtobufReader;
      9 
     10 // repeated bytes s = 1;
     11 public class StringTable implements Message<List<String>> {
     12     @Override
     13     public List<String> parse(Iterator<ProtobufReader> iter) {
     14         List<String> table = new ArrayList<>();
     15         while (iter.hasNext()) {
     16             ProtobufReader message = iter.next();
     17             switch (message.tag()) {
     18                 case 1 -> table.add(message.string());
     19                 default -> message.throwUnexpected();
     20             }
     21         }
     22 
     23         return table;
     24     }
     25 }