Examples of Media


Examples of qurtext.domain.Media

  public byte[] getMediaContent(String urlPath, String params, boolean isPost, String cacheKey) {
    if (null!=cacheKey) {
      byte[] content=(byte[]) cache.get(cacheKey);
      if (null!=content) return content;
    }
    Media source=getMedia(urlPath,params);
    if (null!=source) {
      if (null!=cacheKey) {
        byte[] content=source.getContent();
        if (null!=content) cache.put(cacheKey, content);
      }
      return source.getContent();
    }
    HttpURLConnection connection = null;
    try {
      ByteArrayOutputStream result=new ByteArrayOutputStream();
        if (isPost) {
          URL url = new URL(urlPath);
          connection = (HttpURLConnection) url.openConnection();
          connection.setDoOutput(true);
          connection.setRequestMethod("POST");
          OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream());
        writer.write(params);
          writer.close();
        } else if (params.indexOf("=")<=0) { // not a param but a filename
          URL url = new URL(urlPath + params);
          connection = (HttpURLConnection) url.openConnection();
        } else {
          URL url = new URL(urlPath + "?" + params);
          connection = (HttpURLConnection) url.openConnection();
        }
  
        if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {
            InputStream reader = connection.getInputStream();
            byte[] buffer=new byte[102400];
            int byteRead;

            while ((byteRead = reader.read(buffer)) > 0) {
                result.write(buffer,0,byteRead);
            }
            reader.close();
            source=new Media(urlPath,params,result.toByteArray());
            saveMedia(source);
        if (null!=cacheKey) {
          byte[] content=source.getContent();
          if (null!=content) cache.put(cacheKey, content);
        }
            return source.getContent();
        } else {
            return connection.getResponseMessage().getBytes();
        }
    } catch (MalformedURLException e) {
        return e.getMessage().getBytes();
View Full Code Here

Examples of rocks.xmpp.extensions.data.mediaelement.model.Media

        DataForm dataForm = unmarshal(xml, DataForm.class);

        Assert.assertNotNull(dataForm);
        Assert.assertEquals(dataForm.getType(), DataForm.Type.FORM);
        Media media = dataForm.getFields().get(0).getMedia();
        Assert.assertNotNull(media);
        Assert.assertEquals(media.getHeight(), 0);
        Assert.assertEquals(media.getWidth(), 0);
    }
View Full Code Here

Examples of serializers.activemq.protobuf.MediaContentHolder.Media

        assetEquals(image.getWidth(), 0);
        assetEquals(image.getHeight(), 0);
    }

    public void checkMediaField(MediaContent content) {
        Media media = content.getMedia().copy();
        assetEquals(media.getUri(), "http://javaone.com/keynote.mpg");
        assetEquals(media.getFormat(), "video/mpg4");
        assetEquals(media.getTitle(), "Javaone Keynote");
        assetEquals(media.getDuration(), 1234567L);
        assetEquals(media.getSize(), 123L);
        assetEquals(media.getBitrate(), 0);
        assetEquals(media.getPlayer(), Player.JAVA);
        assetEquals(media.getWidth(), 0);
        assetEquals(media.getHeight(), 0);
    }
View Full Code Here

Examples of serializers.extjava.Media

      ois.close();
      return mediaContent;
   }

   public MediaContent create() {
      Media media = new Media(null, "video/mpg4", Player.JAVA, "Javaone Keynote", "http://javaone.com/keynote.mpg", 1234567, 123, 0, 0, 0);
      media.addToPerson("Bill Gates");
      media.addToPerson("Steve Jobs");

      Image image1 = new Image(0, "Javaone Keynote", "http://javaone.com/keynote_large.jpg", 0, Size.LARGE);
      Image image2 = new Image(0, "Javaone Keynote", "http://javaone.com/keynote_thumbnail.jpg", 0, Size.SMALL);

      MediaContent content = new MediaContent(media);
View Full Code Here

Examples of serializers.java.Media


    public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context)
    {
      reader.moveDown();
      Media media = (Media) context.convertAnother(null, Media.class);
      reader.moveUp();
      MediaContent content = new MediaContent(media);
      reader.moveDown();
      content.addImage((Image) context.convertAnother(content, Image.class));
      reader.moveUp();
View Full Code Here

Examples of serializers.protobuf.MediaContentHolder.Media

      assetEquals(image.getWidth(), 0);
      assetEquals(image.getHeight(), 0);
  }

  public void checkMediaField(MediaContent content) {
      Media media = content.getMedia();
      assetEquals(media.getUri(), "http://javaone.com/keynote.mpg");
      assetEquals(media.getFormat(), "video/mpg4");
      assetEquals(media.getTitle(), "Javaone Keynote");
      assetEquals(media.getDuration(), 1234567L);
      assetEquals(media.getSize(), 123L);
      assetEquals(media.getBitrate(), 0);
      assetEquals(media.getPlayer(), Player.JAVA);
      assetEquals(media.getWidth(), 0);
      assetEquals(media.getHeight(), 0);
  }
View Full Code Here

Examples of serializers.scala.Media

    return array;
  }

  public MediaContent create()
  {
    Media media = new Media("http://javaone.com/keynote.mpg", "Javaone Keynote", 0, 0, "video/mpg4", 1234567, 123, 0, Player.JAVA());
    media.addPerson("Bill Gates");
    media.addPerson("Steve Jobs");

    Image image1 = new Image("http://javaone.com/keynote_large.jpg", "Javaone Keynote", 0, 0, Size.LARGE());

    Image image2 = new Image("http://javaone.com/keynote_thumbnail.jpg", "Javaone Keynote", 0, 0, Size.SMALL());
View Full Code Here

Examples of serializers.thrift.Media

    return array;
  }

  public MediaContent create()
  {
    Media media = new Media();
    media.setUri("http://javaone.com/keynote.mpg");
    media.setFormat("video/mpg4");
    media.setTitle("Javaone Keynote");
    media.setDuration(1234567);
    media.setBitrate(0);
    media.setSize(123);
    media.setWidth(0);
    media.setHeight(0);
    media.addToPerson("Bill Gates");
    media.addToPerson("Steve Jobs");
    media.setPlayer(Player.JAVA);

    Image image1 = new Image("http://javaone.com/keynote_large.jpg", "Javaone Keynote", 0, 0, Size.LARGE);
    Image image2 = new Image("http://javaone.com/keynote_thumbnail.jpg", "Javaone Keynote", 0, 0, Size.SMALL);

    MediaContent content = new MediaContent();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.