public int getInt1_2_4Bytes() {
        byte flagByte = get();
        position(position() - 1);

        if ((flagByte & 0x80) != 0) {
            if ((flagByte & 0x40) != 0) {
                //length 4 bytes
                return getInt() & 0x3FFFFFFF;
            } else {
                //length 2 bytes
                return getShort() & 0x3FFF;
            }
        } else {
            //length 1 byte
            return get();
        }
    }
Reads a 30-bit positive integer from the buffer, which was written using 1, 2, or 4 bytes.

@return the integer read
vespajlib/src/main/java/com/yahoo/io/GrowableByteBuffer.java