<commit_before>package pl.grzeslowski.jsupla.protocol.decoders;

import pl.grzeslowski.jsupla.protocol.consts.ProtoConsts;
import pl.grzeslowski.jsupla.protocol.structs.SuplaDataPacket;

import java.util.Arrays;

import static pl.grzeslowski.jsupla.protocol.consts.JavaConsts.BYTE_SIZE;
import static pl.grzeslowski.jsupla.protocol.consts.JavaConsts.INT_SIZE;

public final class SuplaDataPacketDecoder implements Decoder<SuplaDataPacket> {
    @Override
    public SuplaDataPacket decode(byte[] bytes, int offset) {
        offset += ProtoConsts.SUPLA_TAG_SIZE;

        final short version = PrimitiveDecoder.parseUnsignedByte(bytes, offset);
        offset += BYTE_SIZE;

        final long rrId = PrimitiveDecoder.parseUnsignedInt(bytes, offset);
        offset += INT_SIZE;

        final long callType = PrimitiveDecoder.parseUnsignedInt(bytes, offset);
        offset += INT_SIZE;

        final long dataSize = PrimitiveDecoder.parseUnsignedInt(bytes, offset);
        offset += INT_SIZE;

        final byte[] data = Arrays.copyOfRange(bytes, offset, offset + (int) dataSize);


        return new SuplaDataPacket(version, rrId, callType, dataSize, data);
    }
}<commit_msg>Format<commit_after>package pl.grzeslowski.jsupla.protocol.decoders;

import pl.grzeslowski.jsupla.protocol.consts.ProtoConsts;
import pl.grzeslowski.jsupla.protocol.structs.SuplaDataPacket;

import java.util.Arrays;

import static pl.grzeslowski.jsupla.protocol.consts.JavaConsts.BYTE_SIZE;
import static pl.grzeslowski.jsupla.protocol.consts.JavaConsts.INT_SIZE;

public final class SuplaDataPacketDecoder implements Decoder<SuplaDataPacket> {
    @Override
    public SuplaDataPacket decode(byte[] bytes, int offset) {
        offset += ProtoConsts.SUPLA_TAG_SIZE;

        final short version = PrimitiveDecoder.parseUnsignedByte(bytes, offset);
        offset += BYTE_SIZE;

        final long rrId = PrimitiveDecoder.parseUnsignedInt(bytes, offset);
        offset += INT_SIZE;

        final long callType = PrimitiveDecoder.parseUnsignedInt(bytes, offset);
        offset += INT_SIZE;

        final long dataSize = PrimitiveDecoder.parseUnsignedInt(bytes, offset);
        offset += INT_SIZE;

        final byte[] data = Arrays.copyOfRange(bytes, offset, offset + (int) dataSize);

        return new SuplaDataPacket(version, rrId, callType, dataSize, data);
    }
}
{'fraction_non_alphanumeric': 0.09152542372881356, 'fraction_numerical': 0.0, 'mean_word_length': 4.1103896103896105, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7492223', 'n_tokens_mistral': 754, 'n_tokens_neox': 741, 'n_words': 144}