Sha256: 65505daeacbe73d82795c42142865112f5882b4a095921bb4a1007ae07ced1f1

Contents?: true

Size: 867 Bytes

Versions: 49

Compression:

Stored size: 867 Bytes

Contents

module Protobuf
  class Decoder

    # Read bytes from +stream+ and pass to +message+ object.
    def self.decode_each_field(stream)
      until stream.eof?
        bits = Varint.decode(stream)
        wire_type = bits & 0x07
        tag = bits >> 3

        bytes = if wire_type == ::Protobuf::WireType::VARINT
                  Varint.decode(stream)
                elsif wire_type == ::Protobuf::WireType::LENGTH_DELIMITED
                  value_length = Varint.decode(stream)
                  stream.read(value_length)
                elsif wire_type == ::Protobuf::WireType::FIXED64
                  stream.read(8)
                elsif wire_type == ::Protobuf::WireType::FIXED32
                  stream.read(4)
                else
                  fail InvalidWireType, wire_type
                end

        yield(tag, bytes)
      end
    end
  end
end

Version data entries

49 entries across 49 versions & 4 rubygems

Version Path
protobuf-3.10.9 lib/protobuf/decoder.rb
protobuf-3.10.8 lib/protobuf/decoder.rb
contrast-agent-6.7.0 lib/protobuf/decoder.rb
protobuf-3.10.7 lib/protobuf/decoder.rb
contrast-agent-6.6.5 lib/protobuf/decoder.rb
contrast-agent-6.6.4 lib/protobuf/decoder.rb
contrast-agent-6.6.3 lib/protobuf/decoder.rb
contrast-agent-6.6.2 lib/protobuf/decoder.rb
contrast-agent-6.6.1 lib/protobuf/decoder.rb
contrast-agent-6.6.0 lib/protobuf/decoder.rb
contrast-agent-6.5.1 lib/protobuf/decoder.rb
contrast-agent-6.5.0 lib/protobuf/decoder.rb
contrast-agent-6.4.0 lib/protobuf/decoder.rb
protobuf-3.10.6 lib/protobuf/decoder.rb
protobuf-3.10.5 lib/protobuf/decoder.rb
protobuf-3.10.4 lib/protobuf/decoder.rb
protobuf-cucumber-3.10.8 lib/protobuf/decoder.rb
protobuf-cucumber-3.10.7 lib/protobuf/decoder.rb
protobuf-cucumber-3.10.6 lib/protobuf/decoder.rb
protobuf-cucumber-3.10.5 lib/protobuf/decoder.rb