@Override
    public T deserialize(final byte[] bytes) throws SerializationException {
        if (bytes == null || bytes.length <= HEADER_LENGTH) {
            return delegate.deserialize(bytes);
        }
        val buffer = ByteBuffer.wrap(bytes);
        val originalLength = buffer.getInt();
        val restored = new byte[originalLength];
        decompressor.decompress(
            bytes, HEADER_LENGTH,
            restored, 0, originalLength
        );
        return delegate.deserialize(restored);
    }
Bytes reserved to store original length.
support/cas-server-support-redis-core/src/main/java/org/apereo/cas/redis/core/Lz4CompressionRedisSerializer.java