本文整理匯總了Java中org.jivesoftware.smack.util.StringUtils.UTF8屬性的典型用法代碼示例。如果您正苦於以下問題:Java StringUtils.UTF8屬性的具體用法?Java StringUtils.UTF8怎麽用?Java StringUtils.UTF8使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.jivesoftware.smack.util.StringUtils
的用法示例。
在下文中一共展示了StringUtils.UTF8屬性的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: decodeToString
public static final String decodeToString(String string) {
byte[] bytes = decode(string);
try {
return new String(bytes, StringUtils.UTF8);
} catch (UnsupportedEncodingException e) {
throw new IllegalStateException("UTF-8 not supported", e);
}
}
示例2: decode
@Override
public String decode(String string) {
byte[] bytes = Base64.decode(string, BASE64_ENCODER_FLAGS);
try {
return new String(bytes, StringUtils.UTF8);
} catch (UnsupportedEncodingException e) {
throw new IllegalStateException("UTF-8 not supported", e);
}
}
示例3: isTrustedOmemoIdentity
@Override
public boolean isTrustedOmemoIdentity(OmemoManager omemoManager, OmemoDevice device, OmemoFingerprint fingerprint) {
File trustPath = hierarchy.getContactsTrustPath(omemoManager, device);
try {
String depositedFingerprint = new String(readBytes(trustPath), StringUtils.UTF8);
return depositedFingerprint.length() > 2
&& depositedFingerprint.charAt(0) == '1'
&& new OmemoFingerprint(depositedFingerprint.substring(2)).equals(fingerprint);
} catch (IOException e) {
return false;
}
}
示例4: isDecidedOmemoIdentity
@Override
public boolean isDecidedOmemoIdentity(OmemoManager omemoManager, OmemoDevice device, OmemoFingerprint fingerprint) {
File trustPath = hierarchy.getContactsTrustPath(omemoManager, device);
try {
String depositedFingerprint = new String(readBytes(trustPath), StringUtils.UTF8);
return depositedFingerprint.length() > 2
&& (depositedFingerprint.charAt(0) == '1' || depositedFingerprint.charAt(0) == '2')
&& new OmemoFingerprint(depositedFingerprint.substring(2)).equals(fingerprint);
} catch (IOException e) {
return false;
}
}