io.github.iamaldren.services.CsvConverterService Maven / Gradle / Ivy
package io.github.iamaldren.services;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.MappingIterator;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.csv.CsvMapper;
import com.fasterxml.jackson.dataformat.csv.CsvSchema;
import com.fasterxml.jackson.dataformat.yaml.YAMLMapper;
import io.github.iamaldren.exceptions.ParsingException;
import org.json.JSONArray;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.function.Supplier;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collectors;
public final class CsvConverterService extends AbstractFileService {
private static final Logger log = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
private CsvConverterService() {
log.setLevel(Level.INFO);
}
public static String convertCsvToJson(InputStream in, Map mapHeader) throws ParsingException {
List