예제 #1
0
 function read($fp, &$limit = PHP_INT_MAX)
 {
     while (!feof($fp) && $limit > 0) {
         $tag = Protobuf::read_varint($fp, $limit);
         if ($tag === false) {
             break;
         }
         $wire = $tag & 0x7;
         $field = $tag >> 3;
         //var_dump("LogGroupList: Found $field type " . Protobuf::get_wiretype($wire) . " $limit bytes left");
         switch ($field) {
             case 1:
                 ASSERT('$wire == 2');
                 $len = Protobuf::read_varint($fp, $limit);
                 if ($len === false) {
                     throw new Exception('Protobuf::read_varint returned false');
                 }
                 $limit -= $len;
                 $this->logGroupList_[] = new LogGroup($fp, $len);
                 ASSERT('$len == 0');
                 break;
             default:
                 $this->_unknown[$field . '-' . Protobuf::get_wiretype($wire)][] = Protobuf::read_field($fp, $wire, $limit);
         }
     }
     if (!$this->validateRequired()) {
         throw new Exception('Required fields are missing');
     }
 }
 function read($fp, &$limit = PHP_INT_MAX)
 {
     while (!feof($fp) && $limit > 0) {
         $tag = Protobuf::read_varint($fp, $limit);
         if ($tag === false) {
             break;
         }
         $wire = $tag & 0x7;
         $field = $tag >> 3;
         //var_dump("Response: Found $field type " . Protobuf::get_wiretype($wire) . " $limit bytes left");
         switch ($field) {
             case 1:
                 ASSERT('$wire == 3');
                 $this->responsegroup_[] = new Response_ResponseGroup($fp, $limit);
                 break;
             default:
                 $this->_unknown[$field . '-' . Protobuf::get_wiretype($wire)][] = Protobuf::read_field($fp, $wire, $limit);
         }
     }
     if (!$this->validateRequired()) {
         throw new Exception('Required fields are missing');
     }
 }