Search in sources :

Example 1 with MediaContent

use of data.media.MediaContent in project jvm-serializers by eishay.

the class JacksonCBORDatabind method register.

public static void register(TestGroups groups, boolean sharedNames, boolean sharedValues) {
    CBORFactory factory = new CBORFactory();
    // no point in using enum names with binary format, so:
    ObjectMapper mapper = new ObjectMapper(factory);
    groups.media.add(JavaBuiltIn.mediaTransformer, new StdJacksonDataBind<MediaContent>("cbor/jackson/databind", MediaContent.class, mapper), new SerFeatures(SerFormat.BIN_CROSSLANG, SerGraph.FLAT_TREE, SerClass.ZERO_KNOWLEDGE, ""));
    groups.media.add(JavaBuiltIn.mediaTransformer, new JacksonJsonManual("cbor/jackson/manual", factory), new SerFeatures(SerFormat.BIN_CROSSLANG, SerGraph.FLAT_TREE, SerClass.MANUAL_OPT, ""));
}
Also used : MediaContent(data.media.MediaContent) SerFeatures(serializers.SerFeatures) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Example 2 with MediaContent

use of data.media.MediaContent in project jvm-serializers by eishay.

the class JacksonJsonTree method readMediaContent.

protected static MediaContent readMediaContent(JsonNode root) throws IOException {
    MediaContent mediaContent = new MediaContent();
    mediaContent.media = readMedia(root.get("media"));
    mediaContent.images = readImages((ArrayNode) root.get("images"));
    return mediaContent;
}
Also used : MediaContent(data.media.MediaContent) ArrayNode(com.fasterxml.jackson.databind.node.ArrayNode)

Example 3 with MediaContent

use of data.media.MediaContent in project jvm-serializers by eishay.

the class JacksonSmileDatabind method register.

public static void register(TestGroups groups, boolean sharedNames, boolean sharedValues) {
    SmileFactory factory = new SmileFactory();
    factory.configure(SmileGenerator.Feature.CHECK_SHARED_NAMES, sharedNames);
    factory.configure(SmileGenerator.Feature.CHECK_SHARED_STRING_VALUES, sharedValues);
    // no point in using enum names with binary format, so:
    ObjectMapper mapper = new ObjectMapper(factory);
    mapper.enable(SerializationFeature.WRITE_ENUMS_USING_INDEX);
    groups.media.add(JavaBuiltIn.mediaTransformer, new StdJacksonDataBind<MediaContent>("smile/jackson/databind", MediaContent.class, mapper), new SerFeatures(SerFormat.BINARY, SerGraph.FLAT_TREE, SerClass.ZERO_KNOWLEDGE, ""));
}
Also used : MediaContent(data.media.MediaContent) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Example 4 with MediaContent

use of data.media.MediaContent in project jvm-serializers by eishay.

the class JacksonWithAfterburner method registerCBOR.

public static void registerCBOR(TestGroups groups) {
    ObjectMapper mapper = new ObjectMapper(new CBORFactory());
    mapper.registerModule(new AfterburnerModule());
    groups.media.add(JavaBuiltIn.mediaTransformer, new StdJacksonDataBind<MediaContent>("cbor/jackson+afterburner/databind", MediaContent.class, mapper), new SerFeatures(SerFormat.BINARY, SerGraph.FLAT_TREE, SerClass.ZERO_KNOWLEDGE, STD_DESC));
}
Also used : AfterburnerModule(com.fasterxml.jackson.module.afterburner.AfterburnerModule) CBORFactory(com.fasterxml.jackson.dataformat.cbor.CBORFactory) MediaContent(data.media.MediaContent) SerFeatures(serializers.SerFeatures) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Example 5 with MediaContent

use of data.media.MediaContent in project jvm-serializers by eishay.

the class BaseStaxMediaSerializer method deserialize.

// // Public API
@Override
public MediaContent deserialize(byte[] array) throws XMLStreamException {
    XMLStreamReader parser = createReader(array);
    MediaContent content = _deserializer.readDocument(parser);
    parser.close();
    return content;
}
Also used : XMLStreamReader(javax.xml.stream.XMLStreamReader) MediaContent(data.media.MediaContent)

Aggregations

MediaContent (data.media.MediaContent)23 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)7 SerFeatures (serializers.SerFeatures)4 AfterburnerModule (com.fasterxml.jackson.module.afterburner.AfterburnerModule)3 Image (data.media.Image)3 Media (data.media.Media)2 ArrayList (java.util.ArrayList)2 XMLStreamReader (javax.xml.stream.XMLStreamReader)2 JSONLexer (com.alibaba.fastjson.parser.JSONLexer)1 SerializeConfig (com.alibaba.fastjson.serializer.SerializeConfig)1 SerializeWriter (com.alibaba.fastjson.serializer.SerializeWriter)1 JsonFactory (com.fasterxml.jackson.core.JsonFactory)1 JavaType (com.fasterxml.jackson.databind.JavaType)1 ObjectReader (com.fasterxml.jackson.databind.ObjectReader)1 ObjectWriter (com.fasterxml.jackson.databind.ObjectWriter)1 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)1 AvroFactory (com.fasterxml.jackson.dataformat.avro.AvroFactory)1 AvroSchema (com.fasterxml.jackson.dataformat.avro.AvroSchema)1 CBORFactory (com.fasterxml.jackson.dataformat.cbor.CBORFactory)1 SmileFactory (com.fasterxml.jackson.dataformat.smile.SmileFactory)1