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, ""));
}
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;
}
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, ""));
}
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));
}
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;
}
Aggregations