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

tech.ytsaurus.client.TableAttachmentWireProtocolReader Maven / Gradle / Ivy

The newest version!
package tech.ytsaurus.client;

import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;

import tech.ytsaurus.client.rows.WireProtocolReader;
import tech.ytsaurus.client.rows.WireRowDeserializer;

class TableAttachmentWireProtocolReader extends TableAttachmentRowsetReader {
    private final WireRowDeserializer deserializer;

    TableAttachmentWireProtocolReader(WireRowDeserializer deserializer) {
        this.deserializer = Objects.requireNonNull(deserializer);
    }

    @Override
    protected List parseMergedRow(ByteBuffer bb, int size) {
        byte[] data = new byte[size];
        bb.get(data);

        WireProtocolReader reader = new WireProtocolReader(Arrays.asList(data));

        Objects.requireNonNull(currentReadSchema);
        deserializer.updateSchema(currentReadSchema);

        int rowCount = reader.readRowCount();

        List rows = new ArrayList<>(rowCount);

        for (int i = 0; i < rowCount; ++i) {
            rows.add(reader.readUnversionedRow(deserializer));
        }

        return rows;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy