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

org.redkalex.source.pgsql.RespRowDataDecoder Maven / Gradle / Ivy

There is a newer version: 2.7.7
Show newest version
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package org.redkalex.source.pgsql;

import org.redkale.util.ByteBufferReader;

/**
 *
 * @author zhangjx
 */
public class RespRowDataDecoder implements RespDecoder {

    @Override
    public byte messageid() {
        return 'D';
    }

    @Override
    public RowData read(final ByteBufferReader buffer, final int length, final byte[] bytes) {
        byte[][] values = new byte[buffer.getShort()][];
        for (int i = 0; i < values.length; i++) {
            int sublength = buffer.getInt();
            if (sublength != -1) {
                values[i] = new byte[sublength];
                buffer.get(values[i]);
            } else {
                values[i] = null;
            }
        }
        return new RowData(values);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy