All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.opentelemetry.exporter.logging.otlp.JsonUtil Maven / Gradle / Ivy

There is a newer version: 1.45.0
Show newest version
/*
 * Copyright The OpenTelemetry Authors
 * SPDX-License-Identifier: Apache-2.0
 */

package io.opentelemetry.exporter.logging.otlp;

import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.io.SegmentedStringWriter;
import java.io.IOException;

final class JsonUtil {

  static final JsonFactory JSON_FACTORY = new JsonFactory();

  static JsonGenerator create(SegmentedStringWriter stringWriter) {
    try {
      return JSON_FACTORY.createGenerator(stringWriter);
    } catch (IOException e) {
      throw new IllegalStateException("Unable to create in-memory JsonGenerator, can't happen.", e);
    }
  }

  private JsonUtil() {}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy