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

com.aliyun.tair.tairts.params.ExtsStringMaddParams Maven / Gradle / Ivy

package com.aliyun.tair.tairts.params;

import redis.clients.jedis.params.Params;
import redis.clients.jedis.util.SafeEncoder;

import java.util.ArrayList;

import static redis.clients.jedis.Protocol.toByteArray;

public class ExtsStringMaddParams extends Params {
    public byte[][] getByteParams(String pkey, ArrayList> args) {
        ArrayList byteParams = new ArrayList();
        byteParams.add(SafeEncoder.encode(pkey));
        byteParams.add(SafeEncoder.encode(String.valueOf(args.size())));
        for (ExtsStringDataPoint arg : args) {
            byteParams.add(SafeEncoder.encode(arg.getSkey()));
            byteParams.add(SafeEncoder.encode(arg.getTs()));
            byteParams.add(SafeEncoder.encode(arg.getValue()));
        }
        return byteParams.toArray(new byte[byteParams.size()][]);
    }

    public byte[][] getByteParams(byte[] pkey, ArrayList> args) {
        ArrayList byteParams = new ArrayList();
        byteParams.add(pkey);
        byteParams.add(toByteArray(args.size()));
        for (ExtsStringDataPoint arg : args) {
            byteParams.add(arg.getSkey());
            byteParams.add(arg.getTs());
            byteParams.add(arg.getValue());
        }
        return byteParams.toArray(new byte[byteParams.size()][]);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy