Package com.google.wave.api

Examples of com.google.wave.api.Attachment


          data = Base64.decodeBase64(encodedData.getBytes("UTF-8"));
        } catch (UnsupportedEncodingException e) {
          throw new JsonParseException("Couldn't convert to utf-8", e);
        }
      }
      result = new Attachment(properties, data);
    } else if (type == ElementType.LINE) {
      result = new Line(properties);
    } else {
      result = new Element(type, properties);
    }
View Full Code Here


  public JsonElement serialize(Element src, Type typeOfSrc, JsonSerializationContext context) {
    JsonObject jsonObject = new JsonObject();
    jsonObject.addProperty(TYPE_TAG, src.getType().toString());
    JsonObject properties = new JsonObject();
    if (src.isAttachment()) {
      Attachment attachment = (Attachment) src;
      if (attachment.hasData()) {
        byte[] encodedData = Base64.encodeBase64(attachment.getData());
        try {
          properties.add(Attachment.DATA, new JsonPrimitive(
            new String(encodedData, "UTF-8")));
        } catch (UnsupportedEncodingException e) {
          // this shouldn't happen, so let it slide.
View Full Code Here

          data = Base64.decodeBase64(encodedData.getBytes("UTF-8"));
        } catch (UnsupportedEncodingException e) {
          throw new JsonParseException("Couldn't convert to utf-8", e);
        }
      }
      result = new Attachment(properties, data);
    } else if (type == ElementType.LINE) {
      result = new Line(properties);
    } else {
      result = new Element(type, properties);
    }
View Full Code Here

  public JsonElement serialize(Element src, Type typeOfSrc, JsonSerializationContext context) {
    JsonObject jsonObject = new JsonObject();
    jsonObject.addProperty(TYPE_TAG, src.getType().toString());
    JsonObject properties = new JsonObject();
    if (src.isAttachment()) {
      Attachment attachment = (Attachment) src;
      if (attachment.hasData()) {
        byte[] encodedData = Base64.encodeBase64(attachment.getData());
        try {
          properties.add(Attachment.DATA, new JsonPrimitive(
            new String(encodedData, "UTF-8")));
        } catch (UnsupportedEncodingException e) {
          // this shouldn't happen, so let it slide.
View Full Code Here

TOP

Related Classes of com.google.wave.api.Attachment

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.