<commit_before>package com.nhn.pinpoint.thrift.io;

import org.apache.thrift.TBase;
import org.apache.thrift.TException;
import org.apache.thrift.protocol.TCompactProtocol;
import org.apache.thrift.protocol.TProtocol;
import org.apache.thrift.protocol.TProtocolFactory;
import org.apache.thrift.transport.TIOStreamTransport;

import java.io.ByteArrayOutputStream;
import java.io.UnsupportedEncodingException;

/**
 * Generic utility for easily serializing objects into a byte array or Java
 * String.
 */
public class SafeHeaderTBaseSerializer {

    /**
     * This is the byte array that data is actually serialized into
     */
    // udp 패킷 사이즈에 최대 맞춤.
    private final ByteArrayOutputStream baos_ = new ByteArrayOutputStream(1024 * 4);

    /**
     * This transport wraps that byte array
     */
    private final TIOStreamTransport transport_ = new TIOStreamTransport(baos_);

    /**
     * Internal protocol used for serializing objects.
     */
    private TProtocol protocol_;

    /**
     * Create a new TSerializer that uses the TBinaryProtocol by default.
     */
    public SafeHeaderTBaseSerializer() {

        this(new TCompactProtocol.Factory(), new DefaultTBaseLocator());
    }

    private TBaseLocator locator;

    /**
     * Create a new TSerializer. It will use the TProtocol specified by the
     * factory that is passed in.
     *<commit_msg>[강운덕] [LUCYSUS-1744] tbaselocator를 적게 생성하도록 변경.<commit_after>package com.nhn.pinpoint.thrift.io;

import org.apache.thrift.TBase;
import org.apache.thrift.TException;
import org.apache.thrift.protocol.TCompactProtocol;
import org.apache.thrift.protocol.TProtocol;
import org.apache.thrift.protocol.TProtocolFactory;
import org.apache.thrift.transport.TIOStreamTransport;

import java.io.ByteArrayOutputStream;
import java.io.UnsupportedEncodingException;

/**
 * Generic utility for easily serializing objects into a byte array or Java
 * String.
 */
public class SafeHeaderTBaseSerializer {

    /**
     * This is the byte array that data is actually serialized into
     */
    // udp 패킷 사이즈에 최대 맞춤.
    private final ByteArrayOutputStream baos_ = new ByteArrayOutputStream(1024 * 4);

    /**
     * This transport wraps that byte array
     */
    private final TIOStreamTransport transport_ = new TIOStreamTransport(baos_);

    /**
     * Internal protocol used for serializing objects.
     */
    private TProtocol protocol_;

    private static final TBaseLocator DEFAULT_TBASE_LOCATOR = new DefaultTBaseLocator();
    /**
     * Create a new TSerializer that uses the TBinaryProtocol by default.
     */
    public SafeHeaderTBaseSerializer() {

        this(new TCompactProtocol.Factory(), DEFAULT_TBASE_LOCATOR);
    }

    private TBaseLocator locator;

    /**
     * Create a new TSerializer. It will use the TProtocol specified by the
     * factory that is passed in.
     *
{'fraction_non_alphanumeric': 0.08097731239092495, 'fraction_numerical': 0.004886561954624782, 'mean_word_length': 3.42967542503864, 'pattern_counts': {'":': 0, '<': 3, '<?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': '5528993', 'n_tokens_mistral': 848, 'n_tokens_neox': 847, 'n_words': 239}