Ejemplo n.º 1
0
 /**
  * @param AvroSchema $writers_schema
  * @param AvroIOBinaryDecoder $decoder
  * @return
  * @throws AvroException
  */
 private function skip_data($writers_schema, $decoder)
 {
     switch ($writers_schema->type()) {
         case AvroSchema::NULL_TYPE:
             return $decoder->skip_null();
         case AvroSchema::BOOLEAN_TYPE:
             return $decoder->skip_boolean();
         case AvroSchema::INT_TYPE:
             return $decoder->skip_int();
         case AvroSchema::LONG_TYPE:
             return $decoder->skip_long();
         case AvroSchema::FLOAT_TYPE:
             return $decoder->skip_float();
         case AvroSchema::DOUBLE_TYPE:
             return $decoder->skip_double();
         case AvroSchema::STRING_TYPE:
             return $decoder->skip_string();
         case AvroSchema::BYTES_TYPE:
             return $decoder->skip_bytes();
         case AvroSchema::ARRAY_SCHEMA:
             return $decoder->skip_array($writers_schema, $decoder);
         case AvroSchema::MAP_SCHEMA:
             return $decoder->skip_map($writers_schema, $decoder);
         case AvroSchema::UNION_SCHEMA:
             return $decoder->skip_union($writers_schema, $decoder);
         case AvroSchema::ENUM_SCHEMA:
             return $decoder->skip_enum($writers_schema, $decoder);
         case AvroSchema::FIXED_SCHEMA:
             return $decoder->skip_fixed($writers_schema, $decoder);
         case AvroSchema::RECORD_SCHEMA:
         case AvroSchema::ERROR_SCHEMA:
         case AvroSchema::REQUEST_SCHEMA:
             return $decoder->skip_record($writers_schema, $decoder);
         default:
             throw new AvroException(sprintf('Uknown schema type: %s', $writers_schema->type()));
     }
 }
Ejemplo n.º 2
0
 /**
  * Reads the block header (which includes the count of items in the block
  * and the length in bytes of the block)
  * @returns int length in bytes of the block.
  */
 private function read_block_header()
 {
     $this->block_count = $this->decoder->read_long();
     return $this->decoder->read_long();
 }