@Override
    public byte[] serialize(final T value) throws SerializationException {
        val raw = delegate.serialize(value);
        if (raw == null || raw.length == 0) {
            return raw;
        }
        val maxCompressedLength = compressor.maxCompressedLength(raw.length);
        val compressed = new byte[HEADER_LENGTH + maxCompressedLength];
        ByteBuffer.wrap(compressed).putInt(raw.length);
        val compressedLength = compressor.compress(
            raw, 0, raw.length,
            compressed, HEADER_LENGTH, maxCompressedLength
        );
        return Arrays.copyOf(compressed, 4 + compressedLength);
    }
Bytes reserved to store original length.
support/cas-server-support-redis-core/src/main/java/org/apereo/cas/redis/core/Lz4CompressionRedisSerializer.java