当前位置: 首页>>代码示例>>Java>>正文


Java CharacterSets.MIMENAME_ISO_8859_1属性代码示例

本文整理汇总了Java中ws.com.google.android.mms.pdu.CharacterSets.MIMENAME_ISO_8859_1属性的典型用法代码示例。如果您正苦于以下问题:Java CharacterSets.MIMENAME_ISO_8859_1属性的具体用法?Java CharacterSets.MIMENAME_ISO_8859_1怎么用?Java CharacterSets.MIMENAME_ISO_8859_1使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在ws.com.google.android.mms.pdu.CharacterSets的用法示例。


在下文中一共展示了CharacterSets.MIMENAME_ISO_8859_1属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getMessageText

public static String getMessageText(PduBody body) {
  String bodyText = null;

  for (int i=0;i<body.getPartsNum();i++) {
    if (ContentType.isTextType(Util.toIsoString(body.getPart(i).getContentType()))) {
      String partText;

      try {
        String characterSet = CharacterSets.getMimeName(body.getPart(i).getCharset());

        if (characterSet.equals(CharacterSets.MIMENAME_ANY_CHARSET))
          characterSet = CharacterSets.MIMENAME_ISO_8859_1;

        partText = new String(body.getPart(i).getData(), characterSet);
      } catch (UnsupportedEncodingException e) {
        Log.w("PartParser", e);
        partText = "Unsupported Encoding!";
      }

      bodyText = (bodyText == null) ? partText : bodyText + " " + partText;
    }
  }

  return bodyText;
}
 
开发者ID:redcracker,项目名称:TextSecure,代码行数:25,代码来源:PartParser.java

示例2: SlideDeck

public SlideDeck(Context context, MasterSecret masterSecret, PduBody body) {
  try {
    for (int i=0;i<body.getPartsNum();i++) {
      String contentType = new String(body.getPart(i).getContentType(), CharacterSets.MIMENAME_ISO_8859_1);
      if (ContentType.isImageType(contentType))
        slides.add(new ImageSlide(context, masterSecret, body.getPart(i)));
      else if (ContentType.isVideoType(contentType))
        slides.add(new VideoSlide(context, body.getPart(i)));
      else if (ContentType.isAudioType(contentType))
        slides.add(new AudioSlide(context, body.getPart(i)));
      else if (ContentType.isTextType(contentType))
        slides.add(new TextSlide(context, masterSecret, body.getPart(i)));
    }
  } catch (UnsupportedEncodingException uee) {
    throw new AssertionError(uee);
  }
}
 
开发者ID:redcracker,项目名称:TextSecure,代码行数:17,代码来源:SlideDeck.java

示例3: SlideDeck

public SlideDeck(Context context, MasterSecret masterSecret, PduBody body) {
  try {
    for (int i=0;i<body.getPartsNum();i++) {
      String contentType = new String(body.getPart(i).getContentType(), CharacterSets.MIMENAME_ISO_8859_1);
      if (ContentType.isImageType(contentType))
        slides.add(new ImageSlide(context, masterSecret, body.getPart(i)));
      else if (ContentType.isVideoType(contentType))
        slides.add(new VideoSlide(context, body.getPart(i)));
      else if (ContentType.isAudioType(contentType))
        slides.add(new AudioSlide(context, body.getPart(i)));
      else if (ContentType.isTextType(contentType))
        slides.add(new TextSlide(context, masterSecret, body.getPart(i)));
      else if (ContentType.isOtherType(contentType))
        slides.add(new OtherSlide(context, body.getPart(i)));
    }
  } catch (UnsupportedEncodingException uee) {
    throw new AssertionError(uee);
  }
}
 
开发者ID:Securecom,项目名称:Securecom-Messaging,代码行数:19,代码来源:SlideDeck.java

示例4: SlideDeck

public SlideDeck(Context context, MasterSecret masterSecret, PduBody body) {
  try {
    for (int i=0;i<body.getPartsNum();i++) {
      String contentType = new String(body.getPart(i).getContentType(), CharacterSets.MIMENAME_ISO_8859_1);
      if (ContentType.isImageType(contentType))
        slides.add(new ImageSlide(context, masterSecret, body.getPart(i)));
      else if (ContentType.isVideoType(contentType))
        slides.add(new VideoSlide(context, body.getPart(i)));
      else if (ContentType.isAudioType(contentType))
        slides.add(new AudioSlide(context, body.getPart(i)));
      else if (ContentType.isTextType(contentType))
        slides.add(new TextSlide(context, masterSecret, body.getPart(i)));
    }	
  } catch (UnsupportedEncodingException uee) {
    throw new AssertionError(uee);
  }
}
 
开发者ID:Securecom,项目名称:Securecom-Text,代码行数:17,代码来源:SlideDeck.java

示例5: getMessageText

public static String getMessageText(PduBody body) {
  String bodyText = null;

  for (int i=0;i<body.getPartsNum();i++) {
    if (ContentType.isTextType(Util.toIsoString(body.getPart(i).getContentType()))) {
      String partText;

      try {
        String characterSet = CharacterSets.getMimeName(body.getPart(i).getCharset());

        if (characterSet.equals(CharacterSets.MIMENAME_ANY_CHARSET))
          characterSet = CharacterSets.MIMENAME_ISO_8859_1;

        if (body.getPart(i).getData() != null) {
          partText = new String(body.getPart(i).getData(), characterSet);
        } else {
          partText = "";
        }
      } catch (UnsupportedEncodingException e) {
        Log.w("PartParser", e);
        partText = "Unsupported Encoding!";
      }

      bodyText = (bodyText == null) ? partText : bodyText + " " + partText;
    }
  }

  return bodyText;
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:29,代码来源:PartParser.java

示例6: toIsoString

public static @NonNull String toIsoString(byte[] bytes) {
  try {
    return new String(bytes, CharacterSets.MIMENAME_ISO_8859_1);
  } catch (UnsupportedEncodingException e) {
    throw new AssertionError("ISO_8859_1 must be supported!");
  }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:7,代码来源:Util.java

示例7: getThreadIdFor

private long getThreadIdFor(NotificationInd notification) throws RecipientFormattingException {
  try {
    EncodedStringValue encodedString = notification.getFrom();
    String fromString                = new String(encodedString.getTextString(), CharacterSets.MIMENAME_ISO_8859_1);
    Recipients recipients            = RecipientFactory.getRecipientsFromString(context, fromString, false);
    return DatabaseFactory.getThreadDatabase(context).getThreadIdFor(recipients);
  } catch (UnsupportedEncodingException e) {
    throw new AssertionError(e);
  }
}
 
开发者ID:redcracker,项目名称:TextSecure,代码行数:10,代码来源:MmsDatabase.java

示例8: toIsoString

private String toIsoString(byte[] bytes) {
  try {
    return new String(bytes, CharacterSets.MIMENAME_ISO_8859_1);
  } catch (UnsupportedEncodingException e) {
    Log.e("MmsDatabase", "ISO_8859_1 must be supported!", e);
    return "";
  }
}
 
开发者ID:redcracker,项目名称:TextSecure,代码行数:8,代码来源:MmsAddressDatabase.java

示例9: toIsoString

public static String toIsoString(byte[] bytes) {
  try {
    return new String(bytes, CharacterSets.MIMENAME_ISO_8859_1);
  } catch (UnsupportedEncodingException e) {
    throw new AssertionError("ISO_8859_1 must be supported!");
  }
}
 
开发者ID:redcracker,项目名称:TextSecure,代码行数:7,代码来源:Util.java


注:本文中的ws.com.google.android.mms.pdu.CharacterSets.MIMENAME_ISO_8859_1属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。