Protocol::HPACKSourceProtocolHPACKHuffmanGeneratorNode

class Node

Nested

Definitions

def self.decode(input)

Test decoder

Implementation

def self.decode(input)
	emit = ""
	n = root
	nibbles = input.unpack("C*").flat_map {|b| [((b & 0xf0) >> 4), b & 0xf]}
	until nibbles.empty?
		nb = nibbles.shift
		t = n.transitions[nb]
		emit << t.emit
		n = t.node
	end
	unless n.final && nibbles.all? {|x| x == 0xf}
		puts "len = #{emit.size} n.final = #{n.final} nibbles = #{nibbles}"
	end
	emit
end