* @param foundAt
     * @return
     */
    int nextKey(Key key, int foundAt) {
        int p = foundAt & P_MASK;
        if ((foundAt & EXACT_MASK) != 0)
            p += KEYBLOCK_LENGTH;

        if (p >= _keyBlockEnd)
            return foundAt;

        byte[] kbytes = key.getEncodedBytes();
        int kbData = getInt(p);
        int ebc = decodeKeyBlockEbc(kbData);
        int tail = decodeKeyBlockTail(kbData);
        int tbData = getInt(tail);
        int klength = decodeTailBlockKLength(tbData);
        int keyLength = klength + ebc + 1;
        key.setEncodedSize(keyLength);

        int result = p | (keyLength << DEPTH_SHIFT) | EXACT_MASK;
        //
        // Note: the findKey method is guaranteed to return the offset of a
        // keyblock whose first ebc bytes match the supplied key.
        //
        kbytes[ebc] = (byte) decodeKeyBlockDb(kbData);
        System.arraycopy(_bytes, tail + _tailHeaderSize, kbytes, ebc + 1, klength);

        return result;
    }