All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.lettuce.core.output.ScanOutput Maven / Gradle / Ivy

Go to download

Advanced and thread-safe Java Redis client for synchronous, asynchronous, and reactive usage. Supports Cluster, Sentinel, Pipelining, Auto-Reconnect, Codecs and much more.

The newest version!
package io.lettuce.core.output;

import java.nio.ByteBuffer;

import io.lettuce.core.internal.LettuceStrings;
import io.lettuce.core.ScanCursor;
import io.lettuce.core.codec.RedisCodec;

/**
 * Cursor handling output.
 *
 * @param  Key type.
 * @param  Value type.
 * @param  Cursor type.
 * @author Mark Paluch
 */
public abstract class ScanOutput extends CommandOutput {

    public ScanOutput(RedisCodec codec, T cursor) {
        super(codec, cursor);
    }

    @Override
    public void set(ByteBuffer bytes) {

        if (output.getCursor() == null) {
            output.setCursor(decodeAscii(bytes));
            if (LettuceStrings.isNotEmpty(output.getCursor()) && "0".equals(output.getCursor())) {
                output.setFinished(true);
            }
            return;
        }

        setOutput(bytes);

    }

    protected abstract void setOutput(ByteBuffer bytes);

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy