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

com.firefly.net.tcp.codec.flex.encode.DefaultMetaInfoGenerator Maven / Gradle / Ivy

There is a newer version: 5.0.0-dev6
Show newest version
package com.firefly.net.tcp.codec.flex.encode;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.firefly.net.dataformats.Mapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author Pengtao Qiu
 */
public class DefaultMetaInfoGenerator implements MetaInfoGenerator {

    private static final Logger log = LoggerFactory.getLogger("firefly-system");

    @Override
    public byte[] generate(Object object) {
        try {
            return Mapper.getMessagePackMapper().writeValueAsBytes(object);
        } catch (JsonProcessingException e) {
            log.error("generate msg pack error", e);
            return null;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy