本文整理汇总了Java中ws.com.google.android.mms.pdu.CharacterSets.getMimeName方法的典型用法代码示例。如果您正苦于以下问题:Java CharacterSets.getMimeName方法的具体用法?Java CharacterSets.getMimeName怎么用?Java CharacterSets.getMimeName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ws.com.google.android.mms.pdu.CharacterSets
的用法示例。
在下文中一共展示了CharacterSets.getMimeName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMessageText
import ws.com.google.android.mms.pdu.CharacterSets; //导入方法依赖的package包/类
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: getText
import ws.com.google.android.mms.pdu.CharacterSets; //导入方法依赖的package包/类
@Override
public String getText() {
try {
SoftReference<String> reference = textCache.get(part.getDataUri());
if (reference != null) {
String cachedText = reference.get();
if (cachedText != null) {
return cachedText;
}
}
String text = new String(getPartData(), CharacterSets.getMimeName(part.getCharset()));
textCache.put(part.getDataUri(), new SoftReference<String>(text));
return text;
} catch (UnsupportedEncodingException uee) {
Log.w("TextSlide", uee);
return new String(getPartData());
}
}
示例3: getText
import ws.com.google.android.mms.pdu.CharacterSets; //导入方法依赖的package包/类
@Override
public String getText() {
try {
SoftReference<String> reference = textCache.get(part.getDataUri());
if (reference != null) {
String cachedText = reference.get();
if (cachedText != null) {
return cachedText;
}
}
String text = new String(getPartData(), CharacterSets.getMimeName(part.getCharset()));
textCache.put(part.getDataUri(), new SoftReference<String>(text));
return text;
} catch (UnsupportedEncodingException uee) {
Log.w("TextSlide", uee);
return new String(getPartData());
}
}
示例4: getMessageText
import ws.com.google.android.mms.pdu.CharacterSets; //导入方法依赖的package包/类
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;
}