private int decodeRleLiterals()

in java/src/main/java/com/epam/deltix/zstd/ZstdFrameDecompressor.java [758:793]


    private int decodeRleLiterals(final ByteBuffer inputBase, final int inputAddress, final int blockSize) {
        int input = inputAddress;
        final int outputSize;

        final int type = (inputBase.get(input) >> 2) & 0b11;
        switch (type) {
            case 0:
            case 2:
                outputSize = (inputBase.get(input) & 0xFF) >>> 3;
                input++;
                break;
            case 1:
                outputSize = (inputBase.getShort(input) & 0xFFFF) >>> 4;
                input += 2;
                break;
            case 3:
                // we need at least 4 bytes (3 for the header, 1 for the payload)
                verify(blockSize >= SIZE_OF_INT, input, "Not enough input bytes");
                outputSize = (inputBase.getInt(input) & 0xFF_FFFF) >>> 4;
                input += 3;
                break;
            default:
                throw fail(input, "Invalid RLE literals header encoding type");
        }

        verify(outputSize <= MAX_BLOCK_SIZE, input, "Output exceeds maximum block size");

        final byte value = inputBase.get(input++);
        Arrays.fill(literals, 0, outputSize + SIZE_OF_LONG, value);

        literalsBase = ByteBufferWrap(literals);
        literalsAddress = 0;
        literalsLimit = outputSize;

        return (int) (input - inputAddress);
    }