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

com.geotab.model.serialization.ByteArraySerializer Maven / Gradle / Ivy

/*
 *
 * 2020 Copyright (C) Geotab Inc. All rights reserved.
 */

package com.geotab.model.serialization;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import java.io.IOException;
import org.apache.commons.lang3.ArrayUtils;

public class ByteArraySerializer extends JsonSerializer {

  @Override
  public void serialize(Byte[] bytes, JsonGenerator jsonGenerator, SerializerProvider serializers)
      throws IOException {
    jsonGenerator.writeString(new String(ArrayUtils.toPrimitive(bytes)));
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy