private int readInt(ByteBuffer buffer, int firstByte, int prefixMask) {
            int prefix = firstByte & prefixMask;
            if (prefix < prefixMask) {
                return prefix; // This was a single byte value.
            }

            // This is a multibyte value. Read 7 bits at a time.
            int result = prefixMask;
            int shift = 0;
            while (buffer.hasRemaining()) {
                int b = buffer.get();
                if ((b & 0x80) != 0) { // Equivalent to (b >= 128) since b is in [0..255].
                    result += (b & 0x7f) << shift;
                    shift += 7;
                } else {
                    result += b << shift; // Last byte.
                    break;
                }
            }
            return result;
        }
Read and write HPACK v10.

https://httpwg.org/specs/rfc7540.html#HeaderBlock

This implementation uses an array for the dynamic table and a list for indexed entries.  Dynamic
entries are added to the array, starting in the last position moving forward.  When the array
fills, it is doubled.

@author Megatron King
@since 2019/1/5 20:13
netbare-core/src/main/java/com/github/megatronking/netbare/http2/Hpack.java