<commit_before>package com.netflix.astyanax.serializers;

import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

import com.google.common.base.Function;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.netflix.astyanax.Serializer;

/**
 * A base class for serializer implementations. Takes care of the default
 * implementations of to/fromBytesList and to/fromBytesMap. Extenders of this
 * class only need to implement the toBytes and fromBytes.
 * 
 * @author <NAME>
 * 
 * @param <T>
 */
public abstract class AbstractSerializer<T> implements Serializer<T> {

    @Override
    public abstract ByteBuffer toByteBuffer(T obj);

    @Override
    public byte[] toBytes(T obj) {
        ByteBuffer bb = toByteBuffer(obj);
        byte[] bytes = new byte[bb.remaining()];<commit_msg>AbstractSerializer documentation fix.<commit_after>package com.netflix.astyanax.serializers;

import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

import com.google.common.base.Function;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.netflix.astyanax.Serializer;

/**
 * A base class for serializer implementations. Takes care of the default
 * implementations of to/fromBytesList and to/fromBytesMap. Extenders of this
 * class only need to implement toByteBuffer and fromByteBuffer.
 * 
 * @author <NAME>
 * 
 * @param <T>
 */
public abstract class AbstractSerializer<T> implements Serializer<T> {

    @Override
    public abstract ByteBuffer toByteBuffer(T obj);

    @Override
    public byte[] toBytes(T obj) {
        ByteBuffer bb = toByteBuffer(obj);
        byte[] bytes = new byte[bb.remaining()];
{'fraction_non_alphanumeric': 0.10272638753651411, 'fraction_numerical': 0.0, 'mean_word_length': 4.422163588390501, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '144558', 'n_tokens_mistral': 619, 'n_tokens_neox': 604, 'n_words': 168}