<commit_before>package org.boilit.bsl.encoding;

import org.boilit.bsl.xio.ByteArrayBuffer;

import java.io.IOException;
import java.io.OutputStream;
import java.io.Writer;

/**
 * @author Boilit
 * @see
 */
public abstract class AbstractEncoder implements IEncoder {
    private ThreadLocal<ByteArrayBuffer> localFixedByteArray;

    private final String encoding;

    public AbstractEncoder(final String encoding) {
        this.encoding = encoding;
        this.localFixedByteArray = new ThreadLocal<ByteArrayBuffer>();
        this.localFixedByteArray.set(new ByteArrayBuffer(1024));
    }

    @Override
    public final void write(final OutputStream outputStream, final byte[] bytes) throws IOException {
        outputStream.write(bytes);
    }

    @Override
    public final void write(final Writer writer, final byte[] bytes) throws IOException {
        writer.write(new String(bytes, encoding));
    }

    @Override
    public final void write(final Writer writer, final String string) throws IOException {
        writer.write(string);
    }

    public final String getEncoding() {
        return encoding;
    }

    protected final ByteArrayBuffer getFixedByteArray() {
        return localFixedByteArray.get();
    }
}<commit_msg>update to 1.1.0<commit_after>package org.boilit.bsl.encoding;

import org.boilit.bsl.xio.ByteArrayBuffer;

import java.io.IOException;
import java.io.OutputStream;
import java.io.Writer;

/**
 * @author Boilit
 * @see
 */
public abstract class AbstractEncoder implements IEncoder {
    private static ThreadLocal<ByteArrayBuffer> localFixedByteArray = new ThreadLocal<ByteArrayBuffer>();

    private final String encoding;

    public AbstractEncoder(final String encoding) {
        this.encoding = encoding;
    }

    @Override
    public final void write(final OutputStream outputStream, final byte[] bytes) throws IOException {
        outputStream.write(bytes);
    }

    @Override
    public final void write(final Writer writer, final byte[] bytes) throws IOException {
        writer.write(new String(bytes, encoding));
    }

    @Override
    public final void write(final Writer writer, final String string) throws IOException {
        writer.write(string);
    }

    public final String getEncoding() {
        return encoding;
    }

    protected final ByteArrayBuffer getFixedByteArray() {
        final ByteArrayBuffer buffer = localFixedByteArray.get();
        if (buffer != null) {
            return buffer;
        }
        final ByteArrayBuffer next = new ByteArrayBuffer(1024);
        localFixedByteArray.set(next);
        return next;
    }
}
{'fraction_non_alphanumeric': 0.08539839878002288, 'fraction_numerical': 0.0041936713686618375, 'mean_word_length': 3.2945990180032734, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '3433271', 'n_tokens_mistral': 701, 'n_tokens_neox': 672, 'n_words': 195}