下面列出了java.nio.charset.CharacterCodingException#toString ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* Sets to contain the contents of a string.
*
* @param string input string
*/
public void set(String string) {
try {
ByteBuffer bb = encode(string, true);
bytes = bb.array();
length = bb.limit();
} catch (CharacterCodingException e) {
throw new RuntimeException("Should not have happened "
+ e.toString());
}
}
/**
* Convert text back to string
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
try {
return decode(bytes, 0, length);
} catch (CharacterCodingException e) {
throw new RuntimeException("Should not have happened "
+ e.toString());
}
}
/** Set to contain the contents of a string.
*/
public void set(String string) {
try {
ByteBuffer bb = encode(string, true);
bytes = bb.array();
length = bb.limit();
}catch(CharacterCodingException e) {
throw new RuntimeException("Should not have happened " + e.toString());
}
}
/**
* Convert text back to string
* @see java.lang.Object#toString()
*/
public String toString() {
try {
return decode(bytes, 0, length);
} catch (CharacterCodingException e) {
throw new RuntimeException("Should not have happened " + e.toString());
}
}
/** Set to contain the contents of a string.
*/
public void set(String string) {
try {
ByteBuffer bb = encode(string, true);
bytes = bb.array();
length = bb.limit();
}catch(CharacterCodingException e) {
throw new RuntimeException("Should not have happened " + e.toString());
}
}
/**
* Convert text back to string
* @see java.lang.Object#toString()
*/
public String toString() {
try {
return decode(bytes, 0, length);
} catch (CharacterCodingException e) {
throw new RuntimeException("Should not have happened " + e.toString());
}
}
/**
* Set to contain the contents of a string.
*/
public void set(final String string) {
try {
final ByteBuffer bb = encode(string, true);
this.bytes = bb.array();
this.length = bb.limit();
this.hash = 0;
} catch (CharacterCodingException e) {
throw new RuntimeException("Should not have happened " + e.toString());
}
}
/**
* Convert text back to string
*
* @see java.lang.Object#toString()
*/
public String toString() {
try {
return decode(bytes, 0, length);
} catch (CharacterCodingException e) {
throw new RuntimeException("Should not have happened " + e.toString());
}
}
/** Set to contain the contents of a string.
*/
public void set(String string) {
try {
ByteBuffer bb = encode(string, true);
bytes = bb.array();
length = bb.limit();
}catch(CharacterCodingException e) {
throw new RuntimeException("Should not have happened " + e.toString());
}
}
/**
* Convert text back to string
* @see java.lang.Object#toString()
*/
public String toString() {
try {
return decode(bytes, 0, length);
} catch (CharacterCodingException e) {
throw new RuntimeException("Should not have happened " + e.toString());
}
}
@Override
protected String doInBackground(String... params) {
switch (ResType) {
case ARSC:
for (ContentValues resource : RESOURCES) {
// 获取资源的键
String NAME = (String) resource.get(MyObj.NAME);
// 获取资源的值
String VALUE = (String) resource.get(MyObj.VALUE);
// 获取资源类型
String TYPE = (String) resource.get(MyObj.TYPE);
// 获取资源分支
String CONFIG = (String) resource.get(MyObj.CONFIG);
// 如果资源的Config开头存在-符号,并且Config列表中不存在该资源的Config元素,并且资源种类是params[0]的值
if (CONFIG.startsWith("-") && !Configs.contains(CONFIG.substring(1)) && TYPE.equals(params[0]))
// 向Config列表中添加元素
Configs.add(CONFIG.substring(1));
// 如果资源的Config开头不存在-符号,并且Config列表中不存在该资源的Config元素,并且资源种类是params[0]的值
else if (!CONFIG.startsWith("-") && !Configs.contains(CONFIG) && TYPE.equals(params[0]))
Configs.add(CONFIG);
// 如果资源的Config开头存在-符号,并且Config列表中存在该资源的Config元素,并且Config是params[1]的值
if (TYPE.equals(params[0]) && CONFIG.startsWith("-") && CONFIG.substring(1).equals(params[1])) {
// 向储存字符串的列表中添加字符串成员
txtOriginal.add(VALUE);
// 向储存修改后的字符串的列表中添加空成员
txtTranslated.add("");
// 向储存资源的键的列表添加键
txtTranslated_Key.add(NAME);
// 如果资源的Config开头不存在-符号,并且Config列表中存在该资源的Config元素,并且Config是params[1]的值
} else if (TYPE.equals(params[0]) && !CONFIG.startsWith("-") && CONFIG.equals(params[1])) {
// 向储存字符串的列表中添加字符串成员
txtOriginal.add(VALUE);
// 向储存修改后的字符串的列表中添加空成员
txtTranslated.add("");
// 向储存资源的键的列表添加键
txtTranslated_Key.add(NAME);
}
}
break;
case AXML:
try {
mAndRes.mAXMLDecoder.getStrings(txtOriginal);
for (int i = 0; i < txtOriginal.size(); i++) {
// 向储存修改后的字符串的列表中添加空成员
txtTranslated.add("");
// 向储存资源的键添加空成员
txtTranslated_Key.add("");
}
} catch (CharacterCodingException e) {
return e.toString();
}
break;
case DEX:
break;
}
// 返回一个成功的标志
return getString(R.string.success);
}