public static <T> ByteBuffer buildDbKeyBuffer(final Env<ByteBuffer> lmdbEnv, final T keyObject, Serde<T> keySerde) {
        try {
            return buildDbBuffer(keyObject, keySerde, lmdbEnv.getMaxKeySize());
        } catch (BufferOverflowException e) {
            throw new RuntimeException(LogUtil.message(
                    "The serialised form of keyObject {} is too big for an LMDB key, max bytes is {}",
                    keyObject, lmdbEnv.getMaxKeySize()), e);
        }
    }
Allocates a new direct {@link ByteBuffer} with a size equal to the max key size for the LMDB environment and
serialises the object into that {@link ByteBuffer}

@return The newly allocated {@link ByteBuffer}
stroom-lmdb/src/main/java/stroom/lmdb/LmdbUtils.java