persolijn

an efficient router for busses
Log | Files | Refs

BlobHeader.java (789B)


      1 package osm.message;
      2 
      3 import java.util.Iterator;
      4 
      5 import protobuf.Message;
      6 import protobuf.ProtobufReader;
      7 
      8 // required string type = 1;
      9 // optional bytes indexdata = 2;
     10 // required int32 datasize = 3;
     11 public class BlobHeader implements Message<BlobHeader> {
     12     public long offset;
     13     public String headerType;
     14     public int size;
     15 
     16     @Override
     17     public BlobHeader parse(Iterator<ProtobufReader> iter) {
     18         while (iter.hasNext()) {
     19             ProtobufReader message = iter.next();
     20             switch (message.tag()) {
     21                 case 1 -> headerType = message.string();
     22                 case 2 -> message.skip();
     23                 case 3 -> size = message.varint32();
     24                 default -> message.throwUnexpected();
     25             }
     26         }
     27 
     28         return this;
     29     }
     30 }