<commit_before>package com.treasure_data.bulk_import.prepare_parts;

import java.io.ByteArrayInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

public class Task {
    private static final String TAG = "__PREPARE_FINISH__";
    static final Task FINISH_TASK = new Task(TAG);

    static boolean endTask(Task t) {
        return t.equals(FINISH_TASK);
    }

    public String fileName;

    // unit testing
    public boolean isTest = false;
    public byte[] testBinary = null;

    public Task(String fileName) {
        this.fileName = fileName;
    }

    public InputStream createInputStream(
            PrepareConfiguration.CompressionType compressionType)
            throws IOException {
        if (!isTest) {
            return compressionType.createInputStream(new FileInputStream(fileName));
        } else {
            return new ByteArrayInputStream(testBinary);
        }
    }

    public void finishHook(String outputFileName) {
        // do nothing
    }

    @Override
    public boolean equals(Object obj) {
        if (! (obj instanceof Task)) {
            return false;
        }

        Task t = (Task) obj;
        return t.fileName.equals(fileName);
    }

    @Override
    public String toString() {
        return String.format("prepare_task{file=%s}", fileName);
    }
}<commit_msg>changed bulk_import.prepare_parts.Task class -- implements bulk_import.Task interface<commit_after>package com.treasure_data.bulk_import.prepare_parts;

import java.io.ByteArrayInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

public class Task implements com.treasure_data.bulk_import.Task {
    private static final String TAG = "__PREPARE_FINISH__";
    static final Task FINISH_TASK = new Task(TAG);

    public String fileName;

    // unit testing
    public boolean isTest = false;
    public byte[] testBinary = null;

    public Task(String fileName) {
        this.fileName = fileName;
    }

    public InputStream createInputStream(
            PrepareConfiguration.CompressionType compressionType)
            throws IOException {
        if (!isTest) {
            return compressionType.createInputStream(new FileInputStream(fileName));
        } else {
            return new ByteArrayInputStream(testBinary);
        }
    }

    public void finishHook(String outputFileName) {
        // do nothing
    }

    @Override
    public boolean equals(Object obj) {
        if (! (obj instanceof Task)) {
            return false;
        }

        Task t = (Task) obj;
        return t.fileName.equals(fileName);
    }

    @Override
    public String toString() {
        return String.format("prepare_task{file=%s}", fileName);
    }

    @Override
    public boolean endTask() {
        return equals(FINISH_TASK);
    }
}
{'fraction_non_alphanumeric': 0.08537438768369489, 'fraction_numerical': 0.0, 'mean_word_length': 2.6281725888324874, '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': '6889775', 'n_tokens_mistral': 766, 'n_tokens_neox': 762, 'n_words': 197}