Package data.media

Examples of data.media.MediaContent


    }

    public EishayDecodeBytes(){
        super("EishayDecode-Byte[]");

        content = new MediaContent();

        Media media = new Media();
        media.setUri("http://javaone.com/keynote.mpg");
        media.setTitle("Javaone Keynote");
        media.setWidth(640);
View Full Code Here


public class ListFieldTest3 extends TestCase {

  public void test_typeRef() throws Exception {
    String text = "{\"images\":[],\"media\":{\"width\":640}}";

    MediaContent object = JSON.parseObject(text, MediaContent.class);
  }
View Full Code Here

import data.media.MediaContent;

public class WriteAsArray_Eishay extends TestCase {
    public void test_0 () throws Exception {
        MediaContent content = EishayDecodeBytes.instance.getContent();
       
        String text = JSON.toJSONString(content, SerializerFeature.BeanToArray);
        System.out.println(text.getBytes().length);
        JSON.parseObject(text, MediaContent.class, Feature.SupportArrayToBean);
    }
View Full Code Here

public class MediaContentSerializer implements ObjectSerializer {
    private MediaSerializer mediaSerilaizer = new MediaSerializer();
    private ImageSerializer imageSerilaizer = new ImageSerializer();

    public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType, int features) throws IOException {
        MediaContent entity = (MediaContent) object;

        SerializeWriter out = serializer.getWriter();
        out.write('[');
       
        mediaSerilaizer.write(serializer, entity.getMedia(), "media", Media.class, 0);
        out.write(',');
       
        out.write('[');
        for (int i = 0; i < entity.getImages().size(); ++i) {
            if (i != 0) {
                out.write(',');
            }
            Image image = entity.getImages().get(i);
            imageSerilaizer.write(serializer, image, i, fieldType, 0);
        }
        out.write(']');
       
        out.write(']');
View Full Code Here

        }
        parser.accept(JSONToken.RBRACKET, JSONToken.RBRACKET);
       
        parser.accept(JSONToken.RBRACKET, JSONToken.EOF);
       
        MediaContent content = new MediaContent();
        content.setMedia(media);
        content.setImages(images);
        return (T) content;
    }
View Full Code Here

        System.out.println(text);
    }

    @Override
    public void execute(Codec codec) throws Exception {
        MediaContent content = codec.decodeObject(text, MediaContent.class);
        if (content == null) {
            throw new Exception();
        }
    }
View Full Code Here

TOP

Related Classes of data.media.MediaContent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.