Class: Google::Apis::SafebrowsingV5::GoogleSecuritySafebrowsingV5RiceDeltaEncoded32Bit

Inherits:
Object
  • Object
show all
Includes:
Core::Hashable, Core::JsonObjectSupport
Defined in:
lib/google/apis/safebrowsing_v5/classes.rb,
lib/google/apis/safebrowsing_v5/representations.rb,
lib/google/apis/safebrowsing_v5/representations.rb

Overview

The Rice-Golomb encoded data. Used for either hashes or removal indices. It is guaranteed that every hash or index here has the same length, and this length is exactly 32 bits. Generally speaking, if we sort all the entries lexicographically, we will find that the higher order bits tend not to change as frequently as lower order bits. This means that if we also take the adjacent difference between entries, the higher order bits have a high probability of being zero. This exploits this high probability of zero by essentially choosing a certain number of bits; all bits more significant than this are likely to be zero so we use unary encoding. See the rice_parameter field. Historical note: the Rice-delta encoding was first used in V4 of this API. In V5, two significant improvements were made: firstly, the Rice-delta encoding is now available with hash prefixes longer than 4 bytes; secondly, the encoded data are now treated as big-endian so as to avoid a costly sorting step.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ GoogleSecuritySafebrowsingV5RiceDeltaEncoded32Bit

Returns a new instance of GoogleSecuritySafebrowsingV5RiceDeltaEncoded32Bit.



456
457
458
# File 'lib/google/apis/safebrowsing_v5/classes.rb', line 456

def initialize(**args)
   update!(**args)
end

Instance Attribute Details

#encoded_dataString

The encoded deltas that are encoded using the Golomb-Rice coder. Corresponds to the JSON property encodedData NOTE: Values are automatically base64 encoded/decoded in the client library.

Returns:

  • (String)


434
435
436
# File 'lib/google/apis/safebrowsing_v5/classes.rb', line 434

def encoded_data
  @encoded_data
end

#entries_countFixnum

The number of entries that are delta encoded in the encoded data. If only a single integer was encoded, this will be zero and the single value will be stored in first_value. Corresponds to the JSON property entriesCount

Returns:

  • (Fixnum)


441
442
443
# File 'lib/google/apis/safebrowsing_v5/classes.rb', line 441

def entries_count
  @entries_count
end

#first_valueFixnum

The first entry in the encoded data (hashes or indices), or, if only a single hash prefix or index was encoded, that entry's value. If the field is empty, the entry is zero. Corresponds to the JSON property firstValue

Returns:

  • (Fixnum)


448
449
450
# File 'lib/google/apis/safebrowsing_v5/classes.rb', line 448

def first_value
  @first_value
end

#rice_parameterFixnum

The Golomb-Rice parameter. This parameter is guaranteed to be between 3 and 30, inclusive. Corresponds to the JSON property riceParameter

Returns:

  • (Fixnum)


454
455
456
# File 'lib/google/apis/safebrowsing_v5/classes.rb', line 454

def rice_parameter
  @rice_parameter
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



461
462
463
464
465
466
# File 'lib/google/apis/safebrowsing_v5/classes.rb', line 461

def update!(**args)
  @encoded_data = args[:encoded_data] if args.key?(:encoded_data)
  @entries_count = args[:entries_count] if args.key?(:entries_count)
  @first_value = args[:first_value] if args.key?(:first_value)
  @rice_parameter = args[:rice_parameter] if args.key?(:rice_parameter)
end