<commit_before>package us.ihmc.aci.dspro.pcap.disservice

import io.pkts.buffer.Buffer
import us.ihmc.aci.dspro.pcap.Body

/**
 * Created by gbenincasa on 10/31/17.
 */
class Data(private var buf: Buffer) : Body {

    val msgInfo: MessageInfo
    val data: Buffer

    init {
        val bitmap = buf.readUnsignedByte().toInt()
        val isChunk = (bitmap and 0x0001) != 0
        val sendingComplete = (bitmap and 0x0002) != 0
        val hasStats = (bitmap and 0x0004) != 0
        val isRepair = (bitmap and 0x0008) != 0
        val hasSendRate = (bitmap and 0x0010) != 0
        val hasRateEstimate = (bitmap and 0x0020) != 0
        val doNotForward = (bitmap and 0x0040) != 0
        val rateEstimate = if (hasSendRate || hasRateEstimate) buf.readUnsignedInt() else 0
        msgInfo = MessageInfo(buf)
        data = buf.readBytes(msgInfo.fragmentLength.toInt())
    }

}<commit_msg>Immutable var variables declared val. Added assertions.<commit_after>package us.ihmc.aci.dspro.pcap.disservice

import io.pkts.buffer.Buffer
import us.ihmc.aci.dspro.pcap.Body

/**
 * Created by gbenincasa on 10/31/17.
 */
class Data(private val buf: Buffer) : Body {

    val msgInfo: MessageInfo
    val data: Buffer

    init {
        val bitmap = buf.readUnsignedByte().toInt()
        val isChunk = (bitmap and 0x0001) != 0
        val sendingComplete = (bitmap and 0x0002) != 0
        val hasStats = (bitmap and 0x0004) != 0
        val isRepair = (bitmap and 0x0008) != 0
        val hasSendRate = (bitmap and 0x0010) != 0
        val hasRateEstimate = (bitmap and 0x0020) != 0
        val doNotForward = (bitmap and 0x0040) != 0
        val rateEstimate = if (hasSendRate || hasRateEstimate) buf.readInt() else 0
        msgInfo = MessageInfo(buf)
        data = buf.readBytes(msgInfo.fragmentLength.toInt())
        assert(msgInfo.fragmentLength < Int.MAX_VALUE)
        assert(buf.readableBytes.toLong() == msgInfo.fragmentLength)
    }

}
{'fraction_non_alphanumeric': 0.10699588477366255, 'fraction_numerical': 0.050411522633744855, 'mean_word_length': 2.7403846153846154, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 3, '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': '3831694', 'n_tokens_mistral': 705, 'n_tokens_neox': 630, 'n_words': 172}