Sha256: e6e83b4873472ae4b6859d2f32aa2c00e6708919d653997a815f60679976fac5
Contents?: true
Size: 579 Bytes
Versions: 2
Compression:
Stored size: 579 Bytes
Contents
module Avrocado class Deserializer attr_reader :schema, :message def initialize(message, schema = Schema.parse) @message = message @schema = schema end def self.deserialize(message) new(message).deserialize end def deserialize JSON.parse(reader.read(nil, decoder).to_s) end private def reader @reader ||= Java::Avro::GenericDatumReader.new(schema) end def decoder @decoder ||= Avrocado::DecoderFactory .default_factory .create_binary_decoder(message, nil) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
avrocado-0.1.1 | lib/avrocado/deserializer.rb |
avrocado-0.1.0 | lib/avrocado/deserializer.rb |