Example usage for java.io UnsupportedEncodingException printStackTrace

List of usage examples for java.io UnsupportedEncodingException printStackTrace

Introduction

In this page you can find the example usage for java.io UnsupportedEncodingException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:com.aqnote.shared.cryptology.digest.SHA.java

public final static String sha512_224(String src) {
    if (src == null)
        return "";
    try {/*from  ww  w  .  j  a  v  a2s  .com*/
        return sha512_224(src.getBytes(DEFAULT_CHARSET));
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }
    return "";
}

From source file:com.aqnote.shared.cryptology.digest.SHA.java

public final static String sha512_256(String src) {
    if (isBlank(src))
        return "";
    try {/*from  w ww .  java  2  s.c  o m*/
        return sha512_256(src.getBytes(DEFAULT_CHARSET));
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }
    return "";
}

From source file:com.aqnote.shared.cryptology.digest.SHA.java

public final static String sha3_224(String src) {
    if (isBlank(src))
        return "";
    try {/*ww  w .  ja v a 2s  .com*/
        return sha3_224(src.getBytes(DEFAULT_CHARSET));
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }
    return "";
}

From source file:com.aqnote.shared.cryptology.digest.SHA.java

public final static String sha3_256(String src) {
    if (isBlank(src))
        return "";
    try {//from  w  w w  .j a  va 2  s.  co  m
        return sha3_256(src.getBytes(DEFAULT_CHARSET));
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }
    return "";
}

From source file:com.aqnote.shared.cryptology.digest.SHA.java

public final static String sha3_384(String src) {
    if (isBlank(src))
        return "";
    try {/*from w  w w .j  av  a  2s.c  om*/
        return sha3_384(src.getBytes(DEFAULT_CHARSET));
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }
    return "";
}

From source file:com.aqnote.shared.cryptology.digest.SHA.java

public final static String sha3_512(String src) {
    if (isBlank(src))
        return "";
    try {//  w  w w.java2 s .  co m
        return sha3_512(src.getBytes(DEFAULT_CHARSET));
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }
    return "";
}

From source file:com.atinternet.tracker.Tool.java

/**
 * Encoding a string//w w w  . j a  v a 2  s.  c  o m
 *
 * @param s String
 * @return String
 */
static String percentEncode(String s) {
    try {
        s = URLEncoder.encode(s, "UTF-8");
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }
    return s.replace("+", "%20").replace("*", "%2A").replace("-", "%2D").replace(".", "%2E").replace("_",
            "%5F");
}

From source file:devbox.com.br.minercompanion.ProfileActivity.java

public static String POST(String url, String data, boolean isLoggingOut){
    InputStream inputStream = null;
    String result = "";

    try {//from www. jav a  2 s . co  m

        // 1. create HttpClient
        HttpClient httpclient = new DefaultHttpClient(new BasicHttpParams());

        // 2. make POST request to the given URL
        HttpPost httpPost = new HttpPost(url);


        try {
            List<NameValuePair> params = new ArrayList<NameValuePair>();
            //String usuarios = jsonParser.getAllUsuariosAsJson().toString();

            //Log.i("USUARIOS", usuarios);
            Log.d(TAG, "Dados sendo enviado: " + data);

            //params.add(new BasicNameValuePair("usuarios", usuarios));
            if(isLoggingOut) {
                params.add(new BasicNameValuePair("logout", data));

            } else {
                params.add(new BasicNameValuePair("log", data));
            }


            httpPost.setEntity(new UrlEncodedFormEntity(params));

            HttpResponse response = httpclient.execute(httpPost);

            inputStream = response.getEntity().getContent();

        } catch (UnsupportedEncodingException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        // 10. convert inputstream to string
        if(inputStream != null)
            result = convertInputStreamToString(inputStream);
        else
            result = "Resultado Nulo";

    } catch (Exception e) {
        Log.i(TAG, e.getLocalizedMessage());
    }

    // 11. return result
    return result;
}

From source file:cn.usually.common.pay.union.sdk.SDKUtil.java

/**
 * key=value&key=value?Map//from   ww w  .j  a  va  2 s .c  om
 * 
 * @param result
 * @return
 */
public static Map<String, String> convertResultStringToMap(String result) {
    Map<String, String> map = null;
    try {

        if (StringUtils.isNotBlank(result)) {
            if (result.startsWith("{") && result.endsWith("}")) {
                System.out.println(result.length());
                result = result.substring(1, result.length() - 1);
            }
            map = parseQString(result);
        }

    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }
    return map;
}

From source file:com.ushahidi.android.app.net.MainHttpClient.java

public static HttpResponse PostURL(String URL, List<NameValuePair> data, String Referer) throws IOException {
    Preferences.httpRunning = true;
    // Dipo Fix/*from www. ja v a2s  .  c  o  m*/
    try {
        // wrap try around because this constructor can throw Error
        final HttpPost httpost = new HttpPost(URL);
        // org.apache.http.client.methods.
        if (Referer.length() > 0) {
            httpost.addHeader("Referer", Referer);
        }
        if (data != null) {
            try {
                // NEED THIS NOW TO FIX ERROR 417
                httpost.getParams().setBooleanParameter("http.protocol.expect-continue", false);

                httpost.setEntity(new UrlEncodedFormEntity(data, HTTP.UTF_8));

            } catch (final UnsupportedEncodingException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                Preferences.httpRunning = false;
                return null;
            }
        }

        // Post, check and show the result (not really spectacular, but
        // works):
        try {
            HttpResponse response = httpClient.execute(httpost);
            Preferences.httpRunning = false;
            return response;

        } catch (final Exception e) {

        }
    } catch (final Exception e) {
        e.printStackTrace();
    }

    Preferences.httpRunning = false;
    return null;

}