class ErlangBitstream
def str2int(s, type)
def str2int(s, type) case type when "utf8" then s.encode("utf-8").unpack("C*") when "utf16" then s.encode("utf-16").unpack("C*").drop(2) when "utf32" then s.encode("utf-32").unpack("C*").drop(4) when "integer", "float" then raise "Cannot handle bit string as type #{type}" else s.split("").map { |x| x.ord & 0xff } end end