本文整理汇总了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;
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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;
}
示例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!");
}
}
示例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);
}
}
示例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 "";
}
}
示例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!");
}
}